File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -203,9 +203,9 @@ namespace web { namespace http
203
203
204
204
void handle_pool_timer (const boost::system::error_code& ec);
205
205
206
- // Guards concurrency access to socket/ssl::stream. This is necessary
206
+ // Guards concurrent access to socket/ssl::stream. This is necessary
207
207
// because timeouts and cancellation can touch the socket at the same time
208
- // as normal request read/writing .
208
+ // as normal message processing .
209
209
std::mutex m_socket_lock;
210
210
tcp::socket m_socket;
211
211
std::unique_ptr<boost::asio::ssl::stream<tcp::socket &> > m_ssl_stream;
@@ -393,6 +393,8 @@ namespace web { namespace http
393
393
assert (!m_ctx.expired ());
394
394
if (m_timer.expires_from_now (m_duration) > 0 )
395
395
{
396
+ // The existing handler was canceled so schedule a new one.
397
+ assert (m_state == started);
396
398
auto ctx = m_ctx;
397
399
m_timer.async_wait ([ctx](const boost::system::error_code& ec)
398
400
{
@@ -420,6 +422,7 @@ namespace web { namespace http
420
422
auto shared_ctx = ctx.lock ();
421
423
if (shared_ctx)
422
424
{
425
+ assert (shared_ctx->m_timer .m_state != timedout);
423
426
shared_ctx->m_timer .m_state = timedout;
424
427
shared_ctx->m_connection ->close ();
425
428
}
You can’t perform that action at this time.
0 commit comments