]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
lock store entry during peer selection phase, esp important for ICP
authorwessels <>
Tue, 30 Jun 1998 05:29:16 +0000 (05:29 +0000)
committerwessels <>
Tue, 30 Jun 1998 05:29:16 +0000 (05:29 +0000)
because of delays.
check the cbdata status of the peer select callback in peerSelectTimeout()

src/peer_select.cc

index a9ea8d36f28bfe4c6197067cf102d4151d74f9c5..673c61aede5f9d715fefaf9aa43720d0d5cd4ad9 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: peer_select.cc,v 1.66 1998/06/05 19:02:52 wessels Exp $
+ * $Id: peer_select.cc,v 1.67 1998/06/29 23:29:16 wessels Exp $
  *
  * DEBUG: section 44    Peer Selection Algorithm
  * AUTHOR: Duane Wessels
@@ -83,6 +83,10 @@ peerSelectStateFree(ps_state * psstate)
     }
     requestUnlink(psstate->request);
     psstate->request = NULL;
+    if (psstate->entry) {
+        storeUnlockObject(psstate->entry);
+        psstate->entry = NULL;
+    }
     cbdataFree(psstate);
 }
 
@@ -142,6 +146,7 @@ peerSelect(request_t * request,
     else
        debug(44, 3) ("peerSelect: %s\n", RequestMethodStr[request->method]);
     cbdataAdd(psstate, MEM_NONE);
+    storeLockObject(entry);
     psstate->request = requestLink(request);
     psstate->entry = entry;
     psstate->callback = callback;
@@ -368,6 +373,12 @@ peerPingTimeout(void *data)
 {
     ps_state *psstate = data;
     StoreEntry *entry = psstate->entry;
+    if (!cbdataValid(psstate->callback_data)) {
+       /* request aborted */
+       cbdataUnlock(psstate->callback_data);
+        peerSelectStateFree(psstate);
+       return;
+    }
     if (entry)
        debug(44, 3) ("peerPingTimeout: '%s'\n", storeUrl(entry));
     entry->ping_status = PING_TIMEOUT;