]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Fix assertion on early client disconnect
authorAmos Jeffries <squid3@treenet.co.nz>
Sat, 11 Dec 2010 00:30:47 +0000 (13:30 +1300)
committerAmos Jeffries <squid3@treenet.co.nz>
Sat, 11 Dec 2010 00:30:47 +0000 (13:30 +1300)
Read/Write handlers are called to handle the final byte accounting AFTER
closing teh conn. Handle this case gracefully.

src/client_side.cc

index 1e8c04d2fb3faa10d12a37bd21cbd6656e9d689f..11c788fd89eb9b8c2d5bce023aef6dbbe6d0c890 100644 (file)
@@ -1662,8 +1662,7 @@ ClientSocketContext::getNextRangeOffset() const
 void
 ClientSocketContext::pullData()
 {
-    debugs(33, 5, "ClientSocketContext::pullData: FD " << clientConn() <<
-           " attempting to pull upstream data");
+    debugs(33, 5, HERE << clientConn() << " attempting to pull upstream data");
 
     /* More data will be coming from the stream. */
     StoreIOBuffer readBuffer;
@@ -1820,7 +1819,6 @@ ClientSocketContext::writeComplete(const Comm::ConnectionPointer &conn, char *bu
 {
     StoreEntry *entry = http->storeEntry();
     http->out.size += size;
-    assert(Comm::IsConnOpen(conn));
     debugs(33, 5, HERE << conn << ", sz " << size <<
            ", err " << errflag << ", off " << http->out.size << ", len " <<
            entry ? entry->objectLen() : 0);
@@ -1828,11 +1826,9 @@ ClientSocketContext::writeComplete(const Comm::ConnectionPointer &conn, char *bu
 
     /* Bail out quickly on COMM_ERR_CLOSING - close handlers will tidy up */
 
-    if (errflag == COMM_ERR_CLOSING)
+    if (errflag == COMM_ERR_CLOSING || !Comm::IsConnOpen(conn))
         return;
 
-    assert(Comm::IsConnOpen(clientConn()) && clientConn()->fd == conn->fd);
-
     if (errflag || clientHttpRequestStatus(conn->fd, http)) {
         initiateClose("failure or true request status");
         /* Do we leak here ? */