From: Amos Jeffries Date: Sat, 11 Dec 2010 00:30:47 +0000 (+1300) Subject: Fix assertion on early client disconnect X-Git-Tag: take08~55^2~124^2~21 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=24bf76b52bcbda5b43957398f0ae46b8d74ddc94;p=thirdparty%2Fsquid.git Fix assertion on early client disconnect Read/Write handlers are called to handle the final byte accounting AFTER closing teh conn. Handle this case gracefully. --- diff --git a/src/client_side.cc b/src/client_side.cc index 1e8c04d2fb..11c788fd89 100644 --- a/src/client_side.cc +++ b/src/client_side.cc @@ -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 ? */