mirror of https://github.com/Icinga/icinga2.git
Timeout#Timeout(): don't pass yield_context to callback
It's not used. Also, the callback shall run completely at once. This ensures that it won't (continue to) run once another coroutine on the strand calls Timeout#Cancel().
This commit is contained in:
parent
880632b93a
commit
92ab913226
|
@ -199,7 +199,7 @@ public:
|
|||
}
|
||||
|
||||
auto f (onTimeout);
|
||||
f(std::move(yc));
|
||||
f();
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -141,7 +141,7 @@ void AsioTlsStream::GracefulDisconnect(boost::asio::io_context::strand& strand,
|
|||
|
||||
{
|
||||
Timeout::Ptr shutdownTimeout(new Timeout(strand.context(), strand, boost::posix_time::seconds(10),
|
||||
[this](boost::asio::yield_context yc) {
|
||||
[this] {
|
||||
// Forcefully terminate the connection if async_shutdown() blocked more than 10 seconds.
|
||||
ForceDisconnect();
|
||||
}
|
||||
|
|
|
@ -520,7 +520,7 @@ Timeout::Ptr RedisConnection::MakeTimeout(StreamPtr& stream)
|
|||
m_Strand.context(),
|
||||
m_Strand,
|
||||
boost::posix_time::microseconds(intmax_t(m_ConnectTimeout * 1000000)),
|
||||
[keepAlive, stream](boost::asio::yield_context yc) {
|
||||
[keepAlive, stream] {
|
||||
boost::system::error_code ec;
|
||||
stream->lowest_layer().cancel(ec);
|
||||
}
|
||||
|
|
|
@ -457,7 +457,7 @@ void IfwApiCheckTask::ScriptFunc(const Checkable::Ptr& checkable, const CheckRes
|
|||
*strand,
|
||||
[strand, checkable, cr, psCommand, psHost, expectedSan, psPort, conn, req, checkTimeout, reportResult = std::move(reportResult)](asio::yield_context yc) {
|
||||
Timeout::Ptr timeout = new Timeout(strand->context(), *strand, boost::posix_time::microseconds(int64_t(checkTimeout * 1e6)),
|
||||
[&conn, &checkable](boost::asio::yield_context yc) {
|
||||
[&conn, &checkable] {
|
||||
Log(LogNotice, "IfwApiCheckTask")
|
||||
<< "Timeout while checking " << checkable->GetReflectionType()->GetName()
|
||||
<< " '" << checkable->GetName() << "', cancelling attempt";
|
||||
|
|
|
@ -535,7 +535,7 @@ void ApiListener::ListenerCoroutineProc(boost::asio::yield_context yc, const Sha
|
|||
|
||||
IoEngine::SpawnCoroutine(*strand, [this, strand, sslConn, remoteEndpoint](asio::yield_context yc) {
|
||||
Timeout::Ptr timeout(new Timeout(strand->context(), *strand, boost::posix_time::microseconds(int64_t(GetConnectTimeout() * 1e6)),
|
||||
[sslConn, remoteEndpoint](asio::yield_context yc) {
|
||||
[sslConn, remoteEndpoint] {
|
||||
Log(LogWarning, "ApiListener")
|
||||
<< "Timeout while processing incoming connection from " << remoteEndpoint;
|
||||
|
||||
|
@ -586,7 +586,7 @@ void ApiListener::AddConnection(const Endpoint::Ptr& endpoint)
|
|||
lock.unlock();
|
||||
|
||||
Timeout::Ptr timeout(new Timeout(strand->context(), *strand, boost::posix_time::microseconds(int64_t(GetConnectTimeout() * 1e6)),
|
||||
[sslConn, endpoint, host, port](asio::yield_context yc) {
|
||||
[sslConn, endpoint, host, port] {
|
||||
Log(LogCritical, "ApiListener")
|
||||
<< "Timeout while reconnecting to endpoint '" << endpoint->GetName() << "' via host '" << host
|
||||
<< "' and port '" << port << "', cancelling attempt";
|
||||
|
@ -687,7 +687,7 @@ void ApiListener::NewClientHandlerInternal(
|
|||
strand->context(),
|
||||
*strand,
|
||||
boost::posix_time::microseconds(intmax_t(Configuration::TlsHandshakeTimeout * 1000000)),
|
||||
[strand, client](asio::yield_context yc) {
|
||||
[strand, client] {
|
||||
boost::system::error_code ec;
|
||||
client->lowest_layer().cancel(ec);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue