Skip to content

Commit

Permalink
HttpServerConnection#Disconnect(): add explicit context switches
Browse files Browse the repository at this point in the history
refs #7431
  • Loading branch information
Al2Klimov committed Aug 28, 2019
1 parent 40b9d66 commit c6c7bdf
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/remote/httpserverconnection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,19 @@ void HttpServerConnection::Disconnect()
Log(LogInformation, "HttpServerConnection")
<< "HTTP client disconnected (from " << m_PeerAddress << ")";

AsioConditionVariable cv (IoEngine::Get().GetIoService());

cv.Set();

m_CheckLivenessTimer.cancel();

try {
m_Stream->lowest_layer().cancel();
} catch (...) {
}

cv.Wait(yc);

try {
m_Stream->next_layer().async_shutdown(yc);
} catch (...) {
Expand All @@ -95,6 +101,8 @@ void HttpServerConnection::Disconnect()
} catch (...) {
}

cv.Wait(yc);

auto listener (ApiListener::GetInstance());

if (listener) {
Expand Down

0 comments on commit c6c7bdf

Please sign in to comment.