squid
squid copied to clipboard
Fix PeerDigest lifetime management
This change fixes how cbdata is used for managing CachePeer::digest lifetime. Prior to these changes, cbdata was (ab)used as a reference counting mechanism: CachePeer::digest object could outlive CachePeer (effectively its creator), necessitating complex "is it time to delete this digest?" cleanup logic. Now, CachePeer is an exclusive digest owner that no longer locks/unlocks its digest field; it just creates/deletes the object. Digest fetching code no longer needs to cleanup the digest.
"CachePeer::digest is always valid" invariant simplifies digest fetching code and, hopefully, reduces the probability of bugs similar to Bug 5329 fixed in minimal commit 4657405 (that promised this refactoring).