Skip to content

Commit a28b26f

Browse files
committed
Adding a couple of asserts to timeout_timer.
1 parent 2420067 commit a28b26f

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

Release/src/http/client/http_linux.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,9 +203,9 @@ namespace web { namespace http
203203

204204
void handle_pool_timer(const boost::system::error_code& ec);
205205

206-
// Guards concurrency access to socket/ssl::stream. This is necessary
206+
// Guards concurrent access to socket/ssl::stream. This is necessary
207207
// because timeouts and cancellation can touch the socket at the same time
208-
// as normal request read/writing.
208+
// as normal message processing.
209209
std::mutex m_socket_lock;
210210
tcp::socket m_socket;
211211
std::unique_ptr<boost::asio::ssl::stream<tcp::socket &> > m_ssl_stream;
@@ -393,6 +393,8 @@ namespace web { namespace http
393393
assert(!m_ctx.expired());
394394
if(m_timer.expires_from_now(m_duration) > 0)
395395
{
396+
// The existing handler was canceled so schedule a new one.
397+
assert(m_state == started);
396398
auto ctx = m_ctx;
397399
m_timer.async_wait([ctx](const boost::system::error_code& ec)
398400
{
@@ -420,6 +422,7 @@ namespace web { namespace http
420422
auto shared_ctx = ctx.lock();
421423
if (shared_ctx)
422424
{
425+
assert(shared_ctx->m_timer.m_state != timedout);
423426
shared_ctx->m_timer.m_state = timedout;
424427
shared_ctx->m_connection->close();
425428
}

0 commit comments

Comments
 (0)