]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[5260] Added commentary about making copies of function handlers.
authorMarcin Siodelski <marcin@isc.org>
Tue, 25 Apr 2017 17:04:08 +0000 (19:04 +0200)
committerMarcin Siodelski <marcin@isc.org>
Tue, 25 Apr 2017 17:04:08 +0000 (19:04 +0200)
src/lib/http/connection.cc

index c476869eac3eea1ad3b9c57622292dea2c2c635d..6944bf2b37e59913b50e5b19f84e9b09ac21bb6b 100644 (file)
@@ -50,6 +50,7 @@ HttpConnection::~HttpConnection() {
 
 void
 HttpConnection::close() {
+    request_timer_.cancel();
     socket_.close();
 }
 
@@ -67,6 +68,9 @@ HttpConnection::stopThisConnection() {
 
 void
 HttpConnection::asyncAccept() {
+    // Create instance of the callback. It is safe to pass the local instance
+    // of the callback, because the underlying boost functions make copies
+    // as needed.
     HttpAcceptorCallback cb = boost::bind(&HttpConnection::acceptorCallback,
                                           shared_from_this(),
                                           boost::asio::placeholders::error);
@@ -83,6 +87,9 @@ void
 HttpConnection::doRead() {
     try {
         TCPEndpoint endpoint;
+        // Create instance of the callback. It is safe to pass the local instance
+        // of the callback, because the underlying boost functions make copies
+        // as needed.
         SocketCallback cb(boost::bind(&HttpConnection::socketReadCallback,
                                       shared_from_this(),
                                       boost::asio::placeholders::error,
@@ -99,6 +106,9 @@ void
 HttpConnection::doWrite() {
     try {
         if (!output_buf_.empty()) {
+            // Create instance of the callback. It is safe to pass the local instance
+            // of the callback, because the underlying boost functions make copies
+            // as needed.
             SocketCallback cb(boost::bind(&HttpConnection::socketWriteCallback,
                                           shared_from_this(),
                                           boost::asio::placeholders::error,