diff --git a/lib/remote/httpserverconnection.cpp b/lib/remote/httpserverconnection.cpp index 42adeda4c..aed0fd752 100644 --- a/lib/remote/httpserverconnection.cpp +++ b/lib/remote/httpserverconnection.cpp @@ -88,13 +88,13 @@ void HttpServerConnection::Disconnect() */ boost::system::error_code ec; - m_Stream->next_layer().async_shutdown(yc[ec]); - - m_Stream->lowest_layer().shutdown(m_Stream->lowest_layer().shutdown_both, ec); + m_CheckLivenessTimer.cancel(); m_Stream->lowest_layer().cancel(ec); - m_CheckLivenessTimer.cancel(); + m_Stream->next_layer().async_shutdown(yc[ec]); + + m_Stream->lowest_layer().shutdown(m_Stream->lowest_layer().shutdown_both, ec); auto listener (ApiListener::GetInstance()); diff --git a/lib/remote/jsonrpcconnection.cpp b/lib/remote/jsonrpcconnection.cpp index e8279eac2..5a26812a2 100644 --- a/lib/remote/jsonrpcconnection.cpp +++ b/lib/remote/jsonrpcconnection.cpp @@ -224,14 +224,14 @@ void JsonRpcConnection::Disconnect() */ boost::system::error_code ec; - m_Stream->next_layer().async_shutdown(yc[ec]); - - m_Stream->lowest_layer().shutdown(m_Stream->lowest_layer().shutdown_both, ec); + m_CheckLivenessTimer.cancel(); + m_HeartbeatTimer.cancel(); m_Stream->lowest_layer().cancel(ec); - m_CheckLivenessTimer.cancel(); - m_HeartbeatTimer.cancel(); + m_Stream->next_layer().async_shutdown(yc[ec]); + + m_Stream->lowest_layer().shutdown(m_Stream->lowest_layer().shutdown_both, ec); } }); }