]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Make IdleConn::removeFd err on the soft site if the fd could not be found
authorHenrik Nordstrom <henrik@henriknordstrom.net>
Mon, 7 Apr 2008 22:38:10 +0000 (00:38 +0200)
committerHenrik Nordstrom <henrik@henriknordstrom.net>
Mon, 7 Apr 2008 22:38:10 +0000 (00:38 +0200)
this fixes the assert seen by Tsantilas Christos. It's not really a proper
fix to the underlying problem, but at least makes Squid surive.

The actual problem is race windows introduced by the async call queue. In
this case both "closed by remote server" and "timeout" events may get queued
at the same time, or to be specific the "closed by remote server" read event
stays in the queue and gets called even after pconn has deregistered interest
in the event.

src/pconn.cc

index f8f2e4bc118f73a9242c4db84935d4211d15e540..229657da8151bd353954f991f89a940b9b4ad9ea 100644 (file)
@@ -86,7 +86,10 @@ void
 IdleConnList::removeFD(int fd)
 {
     int index = findFDIndex(fd);
-    assert(index >= 0);
+    if (index < 0) {
+       debugs(48, 0, "IdleConnList::removeFD: FD " << fd << " NOT FOUND!");
+       return;
+    }
     debugs(48, 3, "IdleConnList::removeFD: found FD " << fd << " at index " << index);
 
     for (; index < nfds - 1; index++)