While using Timeout, don't unnecessarily keep the strand alive via smart pointer

This commit is contained in:
Alexander A. Klimov 2024-11-28 16:31:18 +01:00 committed by Yonas Habteab
parent c23bd4c186
commit d69291739f
2 changed files with 2 additions and 4 deletions

View File

@ -511,13 +511,11 @@ void RedisConnection::Handshake(StreamPtr& strm, boost::asio::yield_context& yc)
template<class StreamPtr>
Timeout::Ptr RedisConnection::MakeTimeout(StreamPtr& stream)
{
Ptr keepAlive (this);
return new Timeout(
m_Strand.context(),
m_Strand,
boost::posix_time::microseconds(intmax_t(m_ConnectTimeout * 1000000)),
[keepAlive, stream] {
[stream] {
boost::system::error_code ec;
stream->lowest_layer().cancel(ec);
}

View File

@ -687,7 +687,7 @@ void ApiListener::NewClientHandlerInternal(
strand->context(),
*strand,
boost::posix_time::microseconds(intmax_t(Configuration::TlsHandshakeTimeout * 1000000)),
[strand, client] {
[client] {
boost::system::error_code ec;
client->lowest_layer().cancel(ec);
}