HttpServerConnection: use AsioTlsStream::GracefulDisconnect()

This new helper function has proper timeout handling which was missing here.
This commit is contained in:
Julian Brost 2024-02-12 17:03:54 +01:00
parent 007e3fbe7e
commit e6d103d0dd
1 changed files with 1 additions and 15 deletions

View File

@ -88,23 +88,9 @@ void HttpServerConnection::Disconnect(boost::asio::yield_context yc)
Log(LogInformation, "HttpServerConnection") Log(LogInformation, "HttpServerConnection")
<< "HTTP client disconnected (from " << m_PeerAddress << ")"; << "HTTP client disconnected (from " << m_PeerAddress << ")";
/*
* Do not swallow exceptions in a coroutine.
* https://github.com/Icinga/icinga2/issues/7351
* We must not catch `detail::forced_unwind exception` as
* this is used for unwinding the stack.
*
* Just use the error_code dummy here.
*/
boost::system::error_code ec;
m_CheckLivenessTimer.cancel(); m_CheckLivenessTimer.cancel();
m_Stream->lowest_layer().cancel(ec); m_Stream->GracefulDisconnect(m_IoStrand, yc);
m_Stream->next_layer().async_shutdown(yc[ec]);
m_Stream->lowest_layer().shutdown(m_Stream->lowest_layer().shutdown_both, ec);
auto listener (ApiListener::GetInstance()); auto listener (ApiListener::GetInstance());