mirror of https://github.com/Icinga/icinga2.git
While using Timeout, don't unnecessarily keep the strand alive via smart pointer
This commit is contained in:
parent
8cdbea303b
commit
d2285bcf0e
|
@ -514,13 +514,11 @@ void RedisConnection::Handshake(StreamPtr& strm, boost::asio::yield_context& yc)
|
||||||
template<class StreamPtr>
|
template<class StreamPtr>
|
||||||
Timeout::Ptr RedisConnection::MakeTimeout(StreamPtr& stream)
|
Timeout::Ptr RedisConnection::MakeTimeout(StreamPtr& stream)
|
||||||
{
|
{
|
||||||
Ptr keepAlive (this);
|
|
||||||
|
|
||||||
return new Timeout(
|
return new Timeout(
|
||||||
m_Strand.context(),
|
m_Strand.context(),
|
||||||
m_Strand,
|
m_Strand,
|
||||||
boost::posix_time::microseconds(intmax_t(m_ConnectTimeout * 1000000)),
|
boost::posix_time::microseconds(intmax_t(m_ConnectTimeout * 1000000)),
|
||||||
[keepAlive, stream] {
|
[stream] {
|
||||||
boost::system::error_code ec;
|
boost::system::error_code ec;
|
||||||
stream->lowest_layer().cancel(ec);
|
stream->lowest_layer().cancel(ec);
|
||||||
}
|
}
|
||||||
|
|
|
@ -687,7 +687,7 @@ void ApiListener::NewClientHandlerInternal(
|
||||||
strand->context(),
|
strand->context(),
|
||||||
*strand,
|
*strand,
|
||||||
boost::posix_time::microseconds(intmax_t(Configuration::TlsHandshakeTimeout * 1000000)),
|
boost::posix_time::microseconds(intmax_t(Configuration::TlsHandshakeTimeout * 1000000)),
|
||||||
[strand, client] {
|
[client] {
|
||||||
boost::system::error_code ec;
|
boost::system::error_code ec;
|
||||||
client->lowest_layer().cancel(ec);
|
client->lowest_layer().cancel(ec);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue