Skip to content

Commit

Permalink
Log the peer ID when logging operational IP lookup results. (project-…
Browse files Browse the repository at this point in the history
…chip#34381)

This allows correlating IP results with the peer ID we were resolving.
  • Loading branch information
bzbarsky-apple authored and j-ororke committed Jul 31, 2024
1 parent 4b3a2e7 commit 996993b
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 996993b

Please sign in to comment.