]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Do not stop accepting just because we got COMM_NOMESSAGE.
authorAlex Rousskov <rousskov@measurement-factory.com>
Wed, 7 Jul 2010 00:08:23 +0000 (18:08 -0600)
committerAlex Rousskov <rousskov@measurement-factory.com>
Wed, 7 Jul 2010 00:08:23 +0000 (18:08 -0600)
Do not dereference a possibly NULL callback pointer.

src/comm/ListenStateData.cc
src/comm/ListenStateData.h

index d3c44469dae94a184817fc086bcf9f08435482ea..4e5a304831b5c74806dde63863c3f5ada73f5b95 100644 (file)
@@ -141,7 +141,7 @@ Comm::ListenStateData::okToAccept()
     return false;
 }
 
-bool
+void
 Comm::ListenStateData::acceptOne()
 {
     /*
@@ -159,22 +159,22 @@ Comm::ListenStateData::acceptOne()
 
         if (newfd == COMM_NOMESSAGE) {
             /* register interest again */
-            debugs(5, 5, HERE << "try later: FD " << fd << " handler: " << *theCallback);
+            debugs(5, 5, HERE << "try later: FD " << fd << " handler: " << theCallback);
             commSetSelect(fd, COMM_SELECT_READ, doAccept, this, 0);
-            return false;
+            return;
         }
 
         // A non-recoverable error; notify the caller */
-        debugs(5, 5, HERE << "non-recoverable error: FD " << fd << " handler: " << *theCallback);
+        debugs(5, 5, HERE << "non-recoverable error: FD " << fd << " handler: " << theCallback);
         notify(-1, COMM_ERROR, errno, connDetails);
-        return false;
+        mayAcceptMore = false;
+        return;
     }
 
     debugs(5, 5, HERE << "accepted: FD " << fd <<
            " newfd: " << newfd << " from: " << connDetails.peer <<
-           " handler: " << *theCallback);
+           " handler: " << theCallback);
     notify(newfd, COMM_OK, 0, connDetails);
-    return true;
 }
 
 void
@@ -182,7 +182,7 @@ Comm::ListenStateData::acceptNext()
 {
     assert(isOpen(fd));
     debugs(5, 2, HERE << "connection on FD " << fd);
-    mayAcceptMore = acceptOne();
+    acceptOne();
 }
 
 void
index c7bdc7be2dd822998382a573970aa86c015b1216..66ed358786c465fe090d8c2c6912cdc19a4bd706 100644 (file)
@@ -41,7 +41,7 @@ private:
     /// Method callback for whenever an FD is ready to accept a client connection.
     static void doAccept(int fd, void *data);
 
-    bool acceptOne();
+    void acceptOne();
     int oldAccept(ConnectionDetail &details);
 
     AsyncCall::Pointer theCallback;