diff options
author | lloyd <[email protected]> | 2012-11-07 16:21:56 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2012-11-07 16:21:56 +0000 |
commit | f4cd23a0bf6cf298087c7c6086d57b5de980e049 (patch) | |
tree | 95c15037c7259a472bf45f1ca0c9ebe00e07c520 /src | |
parent | 36a5aaced4bf474514bf32d284b63bc5c3067978 (diff) |
Remove Channel::m_connection_closed, instead deriving it from other state
Diffstat (limited to 'src')
-rw-r--r-- | src/tls/tls_channel.cpp | 17 | ||||
-rw-r--r-- | src/tls/tls_channel.h | 2 |
2 files changed, 11 insertions, 8 deletions
diff --git a/src/tls/tls_channel.cpp b/src/tls/tls_channel.cpp index 88ca474f6..17cf6098e 100644 --- a/src/tls/tls_channel.cpp +++ b/src/tls/tls_channel.cpp @@ -196,7 +196,16 @@ bool Channel::is_active() const bool Channel::is_closed() const { - return m_connection_closed; + if(active_state() || pending_state()) + return false; + + /* + * If no active or pending state, then either we had a connection + * and it has been closed, or we are a server which has never + * received a connection. This case is detectable by also lacking + * m_sequence_numbers + */ + return (m_sequence_numbers != nullptr); } void Channel::activate_session() @@ -363,8 +372,6 @@ size_t Channel::received_data(const byte buf[], size_t buf_size) if(alert_msg.type() == Alert::CLOSE_NOTIFY || alert_msg.is_fatal()) { - m_connection_closed = true; - m_active_state.reset(); m_pending_state.reset(); @@ -493,7 +500,7 @@ void Channel::send(const std::string& string) void Channel::send_alert(const Alert& alert) { - if(alert.is_valid() && !m_connection_closed) + if(alert.is_valid() && !is_closed()) { try { @@ -513,8 +520,6 @@ void Channel::send_alert(const Alert& alert) { m_active_state.reset(); m_pending_state.reset(); - - m_connection_closed = true; } } diff --git a/src/tls/tls_channel.h b/src/tls/tls_channel.h index b7b3d35de..a320a5f3c 100644 --- a/src/tls/tls_channel.h +++ b/src/tls/tls_channel.h @@ -218,8 +218,6 @@ class BOTAN_DLL Channel /* misc, should be removed? */ size_t m_max_fragment = MAX_PLAINTEXT_SIZE; - - bool m_connection_closed = false; }; } |