]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
cleaning up peer and peer_digest interlocking goop
authorwessels <>
Wed, 16 Dec 1998 06:51:19 +0000 (06:51 +0000)
committerwessels <>
Wed, 16 Dec 1998 06:51:19 +0000 (06:51 +0000)
src/neighbors.cc
src/peer_digest.cc

index ce9e2c9e34aefc485d7580cdefd26861525a9aca..250af098d65225eb40922acd9dfa7c7c739b8345 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: neighbors.cc,v 1.264 1998/12/05 00:54:33 wessels Exp $
+ * $Id: neighbors.cc,v 1.265 1998/12/15 23:51:19 wessels Exp $
  *
  * DEBUG: section 15    Neighbor Routines
  * AUTHOR: Harvest Derived
@@ -894,12 +894,9 @@ peerDestroy(void *data, int unused)
     }
     safe_free(p->host);
 #if USE_CACHE_DIGESTS
-    if (p->digest) {
-       if (cbdataValid(p->digest))
-           peerDigestNotePeerGone(p->digest);
+    if (p->digest)
        cbdataUnlock(p->digest);
-       p->digest = NULL;
-    }
+    p->digest = NULL;
 #endif
     xfree(p);
 }
@@ -909,8 +906,9 @@ peerNoteDigestGone(peer * p)
 {
 #if USE_CACHE_DIGESTS
     if (p->digest) {
-       cbdataUnlock(p->digest);
+       PeerDigest *pd = p->digest;
        p->digest = NULL;
+       cbdataUnlock(pd);
     }
 #endif
 }
index 458cf69c733875134429805f36de0107a56e2660..d6259c3ce6cf8e4f0eab260f950d0ad62acfde81 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: peer_digest.cc,v 1.64 1998/12/14 23:45:15 rousskov Exp $
+ * $Id: peer_digest.cc,v 1.65 1998/12/15 23:51:20 wessels Exp $
  *
  * DEBUG: section 72    Peer Digest Routines
  * AUTHOR: Alex Rousskov
@@ -117,14 +117,16 @@ peerDigestCreate(peer * p)
 void
 peerDigestDestroy(PeerDigest * pd)
 {
+    peer *p;
     assert(pd);
     assert(cbdataValid(pd));
 
-    /* inform peer (if any) that we are gone */
-    if (cbdataValid(pd->peer))
-       peerNoteDigestGone(pd->peer);
-    cbdataUnlock(pd->peer);    /* must unlock, valid or not */
+    p = pd->peer;
     pd->peer = NULL;
+    /* inform peer (if any) that we are gone */
+    if (cbdataValid(p))
+       peerNoteDigestGone(p);
+    cbdataUnlock(p);   /* must unlock, valid or not */
 
     peerDigestClean(pd);
     cbdataFree(pd);