]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Author: Alex Rousskov <rousskov@measurement-factory.com>
authorAmos Jeffries <amosjeffries@squid-cache.org>
Wed, 21 Jul 2010 07:17:51 +0000 (01:17 -0600)
committerAmos Jeffries <amosjeffries@squid-cache.org>
Wed, 21 Jul 2010 07:17:51 +0000 (01:17 -0600)
Do not stop accepting just because we got COMM_NOMESSAGE.

Do not dereference a possibly NULL callback pointer.

src/comm.cc

index 36e9054c6f8af88d63913329904dcf75902e296a..5d91eacbd60b10025243f11217b1c316f1c7db83 100644 (file)
@@ -258,7 +258,7 @@ public:
     int fd;
 
 private:
-    bool acceptOne();
+    void acceptOne();
 
     AsyncCall::Pointer theCallback;
     bool mayAcceptMore;
@@ -2284,7 +2284,7 @@ AcceptFD::subscribe(AsyncCall::Pointer &call)
         commSetSelect(fd, COMM_SELECT_READ, comm_accept_try, NULL, 0);
 }
 
-bool
+void
 AcceptFD::acceptOne()
 {
     // If there is no callback and we accept, we will leak the accepted FD.
@@ -2295,7 +2295,8 @@ AcceptFD::acceptOne()
         // either listen always or listen only when there is a callback?
         if (!AcceptLimiter::Instance().deferring())
             commSetSelect(fd, COMM_SELECT_READ, comm_accept_try, NULL, 0);
-        return false;
+        mayAcceptMore = false;
+        return;
     }
 
     /*
@@ -2316,14 +2317,15 @@ AcceptFD::acceptOne()
         if (newfd == COMM_NOMESSAGE) {
             /* register interest again */
             debugs(5, 5, HERE << "try later: FD " << fd <<
-                   " handler: " << *theCallback);
+                   " handler: " << theCallback);
             commSetSelect(fd, COMM_SELECT_READ, comm_accept_try, NULL, 0);
-            return false;
+            return;
         }
 
         // A non-recoverable error; notify the caller */
         notify(-1, COMM_ERROR, errno, connDetails);
-        return false;
+        mayAcceptMore = false;
+        return;
     }
 
     assert(theCallback != NULL);
@@ -2331,13 +2333,13 @@ AcceptFD::acceptOne()
            " newfd: " << newfd << " from: " << connDetails.peer <<
            " handler: " << *theCallback);
     notify(newfd, COMM_OK, 0, connDetails);
-    return true;
+    mayAcceptMore = true;
 }
 
 void
 AcceptFD::acceptNext()
 {
-    mayAcceptMore = acceptOne();
+    acceptOne();
 }
 
 void