Add timeout for boost::asio::ssl::stream#async_shutdown()

refs #7203
This commit is contained in:
Alexander A. Klimov 2020-02-27 13:24:57 +01:00
parent 647f1547a9
commit 19c632e44b
1 changed files with 12 additions and 0 deletions

View File

@ -233,8 +233,20 @@ void JsonRpcConnection::Disconnect()
m_Stream->lowest_layer().cancel(ec);
Timeout::Ptr shutdownTimeout (new Timeout(
m_IoStrand.context(),
m_IoStrand,
boost::posix_time::seconds(10),
[this, keepAlive](asio::yield_context yc) {
boost::system::error_code ec;
m_Stream->lowest_layer().cancel(ec);
}
));
m_Stream->next_layer().async_shutdown(yc[ec]);
shutdownTimeout->Cancel();
m_Stream->lowest_layer().shutdown(m_Stream->lowest_layer().shutdown_both, ec);
}
});