Skip to content

Commit

Permalink
Reduce churn
Browse files Browse the repository at this point in the history
  • Loading branch information
Bronek committed Jul 31, 2024
1 parent 7a4b79b commit b7500df
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/xrpld/overlay/detail/OverlayImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1207,14 +1207,14 @@ std::shared_ptr<Peer>
OverlayImpl::findPeerByPublicKey(PublicKey const& pubKey)
{
std::lock_guard lock(mutex_);
// NOTE The purpose of p is to delay the destruction of PeerImp
std::shared_ptr<PeerImp> p;
for (auto [_, w] : ids_)
// NOTE The purpose of peer is to delay the destruction of PeerImp
std::shared_ptr<PeerImp> peer;
for (auto const& e : ids_)
{
if (p = w.lock(); p != nullptr)
if (peer = e.second.lock(); peer != nullptr)
{
if (p->getNodePublic() == pubKey)
return p;
if (peer->getNodePublic() == pubKey)
return peer;
}
}
return {};
Expand Down

0 comments on commit b7500df

Please sign in to comment.