Skip to content

Commit

Permalink
Add comment for remaining uses of async_shutdown() why it's safe
Browse files Browse the repository at this point in the history
The reason for introducing AsioTlsStream::GracefulDisconnect() was to handle
the TLS shutdown properly with a timeout since it involves a timeout. However,
the implementation of this timeout involves spwaning coroutines which are
redundant in some cases. This commit adds comments to the remaining calls of
async_shutdown() stating why calling it is safe in these places.
  • Loading branch information
julianbrost committed Nov 13, 2024
1 parent 821ff26 commit 9d67c26
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/methods/ifwapichecktask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ static void DoIfwNetIo(
}

{
// Using async_shutdown() instead of AsioTlsStream::GracefulDisconnect() as this whole function
// is already guarded by a timeout based on the check timeout.
boost::system::error_code ec;
sslConn.async_shutdown(yc[ec]);
}
Expand Down
3 changes: 3 additions & 0 deletions lib/remote/apilistener.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -719,6 +719,9 @@ void ApiListener::NewClientHandlerInternal(
// Ignore the error, but do not throw an exception being swallowed at all cost.
// https://github.com/Icinga/icinga2/issues/7351
boost::system::error_code ec;

// Using async_shutdown() instead of AsioTlsStream::GracefulDisconnect() as this whole function
// is already guarded by a timeout based on the connect timeout.
sslConn.async_shutdown(yc[ec]);
}
});
Expand Down

0 comments on commit 9d67c26

Please sign in to comment.