@@ -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