]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Fixes for multiple clients on one StoreEntry. storeAbort() was
authorwessels <>
Tue, 24 Mar 1998 05:10:48 +0000 (05:10 +0000)
committerwessels <>
Tue, 24 Mar 1998 05:10:48 +0000 (05:10 +0000)
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.

src/client_side.cc
src/store_client.cc

index 7ebe769c2b4d0961cbfe4a91692c6a593c653c43..2989169b07bb78ac20cd53881fc796517d78d988 100644 (file)
@@ -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;
index 5cb22ebd7d61331026a1392c314a17182f9604f4..7606240dd8a3e7cefb4c2548a621523d4d3be312 100644 (file)
@@ -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;
 }