Fix secured Websocket closing.

Websocketpp was incorrectly handling close before or during protocol negotiation. This issue addresses lingering CLOSE_WAIT file descriptors.
This commit is contained in:
Miguel Portilla
2016-04-15 12:54:50 -04:00
committed by Nik Bougalis
parent d2071b7ea7
commit d2a787805a
2 changed files with 4 additions and 1 deletions

View File

@@ -1404,6 +1404,8 @@ public:
log_close_result();
}
else
m_state = session::state::CLOSED;
// finally remove this connection from the endpoint's list. This will
// remove the last shared pointer to the connection held by WS++. If we

View File

@@ -914,7 +914,8 @@ void server<endpoint>::connection<connection_type>::handle_write_response(
return;
}
if (m_response.get_status_code() != http::status_code::SWITCHING_PROTOCOLS) {
if (m_response.get_status_code() != http::status_code::SWITCHING_PROTOCOLS ||
m_connection.m_state == session::state::CLOSED) {
if (m_version == -1) {
// if this was not a websocket connection, we have written
// the expected response and the connection can be closed.