]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[5261] Eliminated valgrind errors in libkea-http.
authorMarcin Siodelski <marcin@isc.org>
Wed, 24 May 2017 15:05:56 +0000 (17:05 +0200)
committerMarcin Siodelski <marcin@isc.org>
Wed, 24 May 2017 15:10:12 +0000 (17:10 +0200)
src/lib/http/connection.cc
src/lib/http/connection_pool.cc

index 6944bf2b37e59913b50e5b19f84e9b09ac21bb6b..1e5f5cb2ecf409327350fdb8de2c4fa914e4b723 100644 (file)
@@ -148,8 +148,12 @@ HttpConnection::acceptorCallback(const boost::system::error_code& ec) {
                   HTTP_REQUEST_RECEIVE_START)
             .arg(getRemoteEndpointAddressAsText())
             .arg(static_cast<unsigned>(request_timeout_/1000));
+        // Pass raw pointer rather than shared_ptr to this object,
+        // because IntervalTimer already passes shared pointer to the
+        // IntervalTimerImpl to make sure that the callback remains
+        // valid.
         request_timer_.setup(boost::bind(&HttpConnection::requestTimeoutCallback,
-                                         shared_from_this()),
+                                         this),
                              request_timeout_, IntervalTimer::ONE_SHOT);
         doRead();
     }
index e5a7b5d2afae2e2501c7cb5e1dc4839bdbdc25e2..8d39c02d4dc2c026d3396d0d1db69fd7b78540ed 100644 (file)
@@ -19,6 +19,7 @@ HttpConnectionPool::start(const HttpConnectionPtr& connection) {
 void
 HttpConnectionPool::stop(const HttpConnectionPtr& connection) {
     connections_.remove(connection);
+    connection->close();
 }
 
 void