From: Amos Jeffries Date: Sat, 18 Sep 2010 02:12:08 +0000 (+1200) Subject: Documentation updates and allow const Acceptors to be un-deferred X-Git-Tag: take08~55^2~124^2~59 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2c53add2db22aa9d6a17fe5831792d901f04e967;p=thirdparty%2Fsquid.git Documentation updates and allow const Acceptors to be un-deferred --- diff --git a/src/comm/AcceptLimiter.cc b/src/comm/AcceptLimiter.cc index b4cbcf1c9e..a3ce69935a 100644 --- a/src/comm/AcceptLimiter.cc +++ b/src/comm/AcceptLimiter.cc @@ -20,12 +20,12 @@ Comm::AcceptLimiter::defer(Comm::ConnAcceptor *afd) } void -Comm::AcceptLimiter::removeDead(Comm::ConnAcceptor *afd) +Comm::AcceptLimiter::removeDead(const Comm::ConnAcceptor *afd) { for (unsigned int i = 0; i < deferred.size() && afd->isLimited > 0; i++) { if (deferred[i] == afd) { - deferred[i] = NULL; - afd->isLimited--; + deferred[i]->isLimited--; + deferred[i] = NULL; // fast. kick() will skip empty entries later. debugs(5, 5, HERE << afd->conn << " x" << afd->isLimited); } } @@ -34,6 +34,10 @@ Comm::AcceptLimiter::removeDead(Comm::ConnAcceptor *afd) void Comm::AcceptLimiter::kick() { + // TODO: this could be optimized further with an iterator to search + // looking for first non-NULL, followed by dumping the first N + // with only one shift()/pop_ftron operation + debugs(5, 5, HERE << " size=" << deferred.size()); while (deferred.size() > 0 && fdNFree() >= RESERVED_FD) { /* NP: shift() is equivalent to pop_front(). Giving us a FIFO queue. */ diff --git a/src/comm/AcceptLimiter.h b/src/comm/AcceptLimiter.h index 26b8a8e6b6..a1dd2f2dc5 100644 --- a/src/comm/AcceptLimiter.h +++ b/src/comm/AcceptLimiter.h @@ -29,7 +29,7 @@ public: void defer(Comm::ConnAcceptor *afd); /** remove all records of an acceptor. Only to be called by the ConnAcceptor::swanSong() */ - void removeDead(Comm::ConnAcceptor *afd); + void removeDead(const Comm::ConnAcceptor *afd); /** try to accept and begin processing any delayed client connections. */ void kick();