From: Alex Rousskov Date: Wed, 7 Jul 2010 00:08:23 +0000 (-0600) Subject: Do not stop accepting just because we got COMM_NOMESSAGE. X-Git-Tag: SQUID_3_2_0_1~95 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=971581eed2a1eed456b7b23eed4f9fab37e91046;p=thirdparty%2Fsquid.git Do not stop accepting just because we got COMM_NOMESSAGE. Do not dereference a possibly NULL callback pointer. --- diff --git a/src/comm/ListenStateData.cc b/src/comm/ListenStateData.cc index d3c44469da..4e5a304831 100644 --- a/src/comm/ListenStateData.cc +++ b/src/comm/ListenStateData.cc @@ -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 diff --git a/src/comm/ListenStateData.h b/src/comm/ListenStateData.h index c7bdc7be2d..66ed358786 100644 --- a/src/comm/ListenStateData.h +++ b/src/comm/ListenStateData.h @@ -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;