mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-28 08:04:14 +02:00
ApiListener#NewClientHandlerInternal(): on basic_socket#cancel() (due to timeout) don't ssl::stream#async_shutdown()
If a connection hangs for too long in ApiListener#NewClientHandler(), ApiListener#AddConnection()'s Timeout calls boost::asio::basic_socket#cancel() on that connection to trigger an exception which unwinds ApiListener#NewClientHandler(). Previously that unwind could trigger a Defer which called boost::asio::ssl::stream#async_shutdown() which extended the hang.
This commit is contained in:
parent
243b8aa7a8
commit
e0e10a7efa
@ -734,6 +734,7 @@ void ApiListener::NewClientHandlerInternal(
|
||||
|
||||
ClientType ctype;
|
||||
|
||||
try {
|
||||
if (role == RoleClient) {
|
||||
JsonRpc::SendMessage(client, new Dictionary({
|
||||
{ "jsonrpc", "2.0" },
|
||||
@ -790,6 +791,13 @@ void ApiListener::NewClientHandlerInternal(
|
||||
ctype = ClientHttp;
|
||||
}
|
||||
}
|
||||
} catch (const boost::system::system_error& systemError) {
|
||||
if (systemError.code() == boost::asio::error::operation_aborted) {
|
||||
shutDownIfNeeded.Cancel();
|
||||
}
|
||||
|
||||
throw;
|
||||
}
|
||||
|
||||
if (ctype == ClientJsonRpc) {
|
||||
Log(LogNotice, "ApiListener", "New JSON-RPC client");
|
||||
|
Loading…
x
Reference in New Issue
Block a user