Commit 4c48a72c authored by Marcin Siodelski's avatar Marcin Siodelski
Browse files

[5303] Use raw pointer to the timeout handler class in HTTP connections.

This prevents dangling timers after the connection has been terminated.
parent 8e9aba8c
......@@ -148,8 +148,11 @@ HttpConnection::acceptorCallback(const boost::system::error_code& ec) {
HTTP_REQUEST_RECEIVE_START)
.arg(getRemoteEndpointAddressAsText())
.arg(static_cast<unsigned>(request_timeout_/1000));
// Use 'this' instead of shared_from_this() because the IntervalTimer
// class already submits shared pointer to IntervalTimerImpl to
// protect against premature class instance destruction.
request_timer_.setup(boost::bind(&HttpConnection::requestTimeoutCallback,
shared_from_this()),
this),
request_timeout_, IntervalTimer::ONE_SHOT);
doRead();
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment