From: wessels <> Date: Tue, 24 Mar 1998 05:10:48 +0000 (+0000) Subject: Fixes for multiple clients on one StoreEntry. storeAbort() was X-Git-Tag: SQUID_3_0_PRE1~3763 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=36547bcfaef393c71a93e0ed99bfdc86643623fa;p=thirdparty%2Fsquid.git Fixes for multiple clients on one StoreEntry. storeAbort() was incorrectly being called when one of multiple clients would disconnect. One problem seemed to be that storePendingNClients() counted the number of store_client's with callback functions registered (i.e. assumed all clients had recently called storeClientCopy). storePendingNClients() has been changed to return mem->nclients. This assumes that all clients properly use storeUnregister(), which may not have been the case in the past. Also, clientWriteComplete() would call CheckQuickAbort() if comm_write returned an error. Then CheckQuickAbort() would get called again in httpRequestFree(). The first call seems to be unnecessary, so it is #ifdef'd out for now. --- diff --git a/src/client_side.cc b/src/client_side.cc index 7ebe769c2b..2989169b07 100644 --- a/src/client_side.cc +++ b/src/client_side.cc @@ -1,6 +1,6 @@ /* - * $Id: client_side.cc,v 1.232 1998/03/20 18:02:08 rousskov Exp $ + * $Id: client_side.cc,v 1.233 1998/03/23 22:10:48 wessels Exp $ * * DEBUG: section 33 Client-side Routines * AUTHOR: Duane Wessels @@ -1030,7 +1030,16 @@ clientWriteComplete(int fd, char *bufnotused, size_t size, int errflag, void *da debug(33, 5) ("clientWriteComplete: FD %d, sz %d, err %d, off %d, len %d\n", fd, size, errflag, http->out.offset, objectLen(entry)); if (errflag) { +#if DONT_DO_THIS + /* + * Not sure why this CheckQuickAbort() would be needed here. + * We also call CheckQuickAbort() in httpRequestFree(), which + * gets called as a comm_close handler. We need to be careful + * that CheckQuickAbort() gets called only ONCE, and AFTER + * storeUnregister() has been called. [DW/1.2.beta18] + */ CheckQuickAbort(http); +#endif comm_close(fd); } else if (entry->store_status == STORE_ABORTED) { comm_close(fd); @@ -1974,7 +1983,7 @@ CheckQuickAbort(clientHttpRequest * http) * requests) during the storeAbort() call */ if (entry == NULL) return; - if (storePendingNClients(entry) > 1) + if (storePendingNClients(entry) > 0) return; if (entry->store_status != STORE_PENDING) return; diff --git a/src/store_client.cc b/src/store_client.cc index 5cb22ebd7d..7606240dd8 100644 --- a/src/store_client.cc +++ b/src/store_client.cc @@ -408,8 +408,9 @@ InvokeHandlers(StoreEntry * e) int storePendingNClients(const StoreEntry * e) { - int npend = 0; MemObject *mem = e->mem_obj; + int npend = NULL == mem ? 0 : mem->nclients; +#if OLD_CODE store_client *sc; store_client *nx = NULL; if (mem == NULL) @@ -423,5 +424,7 @@ storePendingNClients(const StoreEntry * e) continue; npend++; } +#endif + debug(20,0)("storePendingNClients: returning %d\n", npend); return npend; }