From 8d4af5be55a819d7043dfe159d89f59de7f69741 Mon Sep 17 00:00:00 2001 From: Chris Rusby Date: Fri, 3 May 2019 22:37:58 +0100 Subject: [PATCH] Wrap additional async_wait falls in strands to prevent crash (see bug report #125) --- source/corvusoft/restbed/detail/socket_impl.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/corvusoft/restbed/detail/socket_impl.cpp b/source/corvusoft/restbed/detail/socket_impl.cpp index f3687c36..a52dc4ee 100644 --- a/source/corvusoft/restbed/detail/socket_impl.cpp +++ b/source/corvusoft/restbed/detail/socket_impl.cpp @@ -412,7 +412,7 @@ namespace restbed { m_timer->cancel( ); m_timer->expires_from_now( m_timeout ); - m_timer->async_wait( bind( &SocketImpl::connection_timeout_handler, this, shared_from_this( ), _1 ) ); + m_timer->async_wait( m_strand->wrap( bind( &SocketImpl::connection_timeout_handler, this, shared_from_this( ), _1 ) ) ); size_t size = 0; auto finished = std::make_shared(false); @@ -461,7 +461,7 @@ namespace restbed { m_timer->cancel( ); m_timer->expires_from_now( m_timeout ); - m_timer->async_wait( bind( &SocketImpl::connection_timeout_handler, this, shared_from_this( ), _1 ) ); + m_timer->async_wait( m_strand->wrap( bind( &SocketImpl::connection_timeout_handler, this, shared_from_this( ), _1 ) ) ); #ifdef BUILD_SSL