Skip to content

Commit 3d0d28a

Browse files
committed
Eliminate spurious expired timers in certain error conditions references #295
1 parent 63cdaec commit 3d0d28a

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

changelog.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
HEAD
2+
- Eliminates spurious expired timers in certain error conditions. Thank you
3+
Banaan for reporting. #295
24
- Consolidates all bundled library licenses into the COPYING file.
35
- Updates bundled sha1 library to one with a cleaner interface and more
46
straight-forward license.

websocketpp/impl/connection_impl.hpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1177,6 +1177,11 @@ void connection<config>::handle_send_http_response(
11771177

11781178
this->log_open_result();
11791179

1180+
if (m_handshake_timer) {
1181+
m_handshake_timer->cancel();
1182+
m_handshake_timer.reset();
1183+
}
1184+
11801185
if (m_response.get_status_code() != http::status_code::switching_protocols)
11811186
{
11821187
if (m_processor) {
@@ -1193,11 +1198,6 @@ void connection<config>::handle_send_http_response(
11931198
return;
11941199
}
11951200

1196-
if (m_handshake_timer) {
1197-
m_handshake_timer->cancel();
1198-
m_handshake_timer.reset();
1199-
}
1200-
12011201
this->atomic_state_change(
12021202
istate::PROCESS_HTTP_REQUEST,
12031203
istate::PROCESS_CONNECTION,
@@ -1339,6 +1339,11 @@ void connection<config>::handle_read_http_response(const lib::error_code& ec,
13391339
m_alog.write(log::alevel::devel,std::string("Raw response: ")+m_response.raw());
13401340

13411341
if (m_response.headers_ready()) {
1342+
if (m_handshake_timer) {
1343+
m_handshake_timer->cancel();
1344+
m_handshake_timer.reset();
1345+
}
1346+
13421347
lib::error_code ec = m_processor->validate_server_handshake_response(
13431348
m_request,
13441349
m_response
@@ -1361,11 +1366,6 @@ void connection<config>::handle_read_http_response(const lib::error_code& ec,
13611366
"handle_read_http_response must be called from READ_HTTP_RESPONSE state"
13621367
);
13631368

1364-
if (m_handshake_timer) {
1365-
m_handshake_timer->cancel();
1366-
m_handshake_timer.reset();
1367-
}
1368-
13691369
this->log_open_result();
13701370

13711371
if (m_open_handler) {

0 commit comments

Comments
 (0)