From dfaeb88ac3e347fd1588afe59dfc136e4a6d7de2 Mon Sep 17 00:00:00 2001 From: "Alexander A. Klimov" Date: Mon, 9 Sep 2019 13:10:12 +0200 Subject: [PATCH] {HttpServer,JsonRpc}Connection#Disconnect(): cancel I/O ops ASAP refs #7431 --- lib/remote/httpserverconnection.cpp | 8 ++++---- lib/remote/jsonrpcconnection.cpp | 10 +++++----- 2 files changed, 9 insertions(+), 9 deletions(-) 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); } }); }