Skip to content

Commit

Permalink
Fix CachePeer.cc:101 "!tcp_up" assertion after cache_peer death (#1962)
Browse files Browse the repository at this point in the history
getFirstUpParent() could return a down (or otherwise disqualified)
cache_peer. Broken by 2023 commit 2e24d0b.

Refactored function structure to improve code quality, partially
addressing "use our return/reporting style" TODO in getDefaultParent().
  • Loading branch information
eduard-bagdasaryan authored and squid-anubis committed Dec 15, 2024
1 parent a48f1be commit e9eb590
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/neighbors.cc
Original file line number Diff line number Diff line change
Expand Up @@ -282,10 +282,8 @@ getFirstUpParent(PeerSelector *ps)
assert(ps);
HttpRequest *request = ps->request;

CachePeer *p = nullptr;

for (const auto &peer: CurrentCachePeers()) {
p = peer.get();
const auto p = peer.get();

if (!neighborUp(p))
continue;
Expand All @@ -296,11 +294,12 @@ getFirstUpParent(PeerSelector *ps)
if (!peerHTTPOkay(p, ps))
continue;

break;
debugs(15, 3, "returning " << *p);
return p;
}

debugs(15, 3, "returning " << RawPointer(p).orNil());
return p;
debugs(15, 3, "none found");
return nullptr;
}

CachePeer *
Expand Down

0 comments on commit e9eb590

Please sign in to comment.