Skip to content

Commit

Permalink
Log the peer ID when logging operational IP lookup results. (#34381)
Browse files Browse the repository at this point in the history
This allows correlating IP results with the peer ID we were resolving.
  • Loading branch information
bzbarsky-apple authored Jul 18, 2024
1 parent ce844bc commit d29b350
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/lib/address_resolve/AddressResolve_DefaultImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,16 @@ void NodeLookupHandle::LookupResult(const ResolveResult & result)
char addr_string[Transport::PeerAddress::kMaxToStringSize];
result.address.ToString(addr_string);

const PeerId peerId = GetRequest().GetPeerId();
if (success)
{
ChipLogProgress(Discovery, "%s: new best score: %u", addr_string, to_underlying(score));
ChipLogProgress(Discovery, "%s: new best score: %u (for " ChipLogFormatPeerId ")", addr_string, to_underlying(score),
ChipLogValuePeerId(peerId));
}
else
{
ChipLogProgress(Discovery, "%s: score has not improved: %u", addr_string, to_underlying(score));
ChipLogProgress(Discovery, "%s: score has not improved: %u (for " ChipLogFormatPeerId ")", addr_string,
to_underlying(score), ChipLogValuePeerId(peerId));
}
#endif
}
Expand Down

0 comments on commit d29b350

Please sign in to comment.