Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve logging for minMdns #10319

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/lib/mdns/Advertiser_ImplMinimalMdns.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,9 @@ class AdvertiserMinMdns : public ServiceAdvertiser,
void AdvertiserMinMdns::OnMdnsPacketData(const BytesRange & data, const chip::Inet::IPPacketInfo * info)
{
#ifdef DETAIL_LOGGING
ChipLogDetail(Discovery, "MinMdns received a query.");
char srcAddressString[chip::Inet::kMaxIPAddressStringLength];
VerifyOrDie(info->SrcAddress.ToString(srcAddressString) != nullptr);
ChipLogDetail(Discovery, "Received an mDNS query from %s", srcAddressString);
#endif

mCurrentSource = info;
Expand Down
7 changes: 5 additions & 2 deletions src/lib/mdns/minimal/ResponseSender.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,16 +161,19 @@ CHIP_ERROR ResponseSender::FlushReply()

if (mResponseBuilder.HasResponseRecords())
{
char srcAddressString[chip::Inet::kMaxIPAddressStringLength];
VerifyOrDie(mSendState.GetSourceAddress().ToString(srcAddressString) != nullptr);
bzbarsky-apple marked this conversation as resolved.
Show resolved Hide resolved

if (mSendState.SendUnicast())
{
ChipLogProgress(Discovery, "Directly sending mDns reply to peer on port %d", mSendState.GetSourcePort());
ChipLogProgress(Discovery, "Directly sending mDns reply to peer %s on port %d", srcAddressString,
mSendState.GetSourcePort());
ReturnErrorOnFailure(mServer->DirectSend(mResponseBuilder.ReleasePacket(), mSendState.GetSourceAddress(),
mSendState.GetSourcePort(), mSendState.GetSourceInterfaceId()));
}
else
{
ChipLogProgress(Discovery, "Broadcasting mDns reply");
ChipLogProgress(Discovery, "Broadcasting mDns reply for query from %s", srcAddressString);
ReturnErrorOnFailure(
mServer->BroadcastSend(mResponseBuilder.ReleasePacket(), kMdnsStandardPort, mSendState.GetSourceInterfaceId()));
}
Expand Down
2 changes: 0 additions & 2 deletions src/lib/mdns/minimal/responders/QueryResponder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,6 @@ void QueryResponderBase::MarkAdditionalRepliesFor(QueryResponderIterator it)

void QueryResponderBase::AddAllResponses(const chip::Inet::IPPacketInfo * source, ResponderDelegate * delegate)
{
ChipLogProgress(Discovery, "Replying to DNS-SD service listing request");

// reply to dns-sd service list request
for (size_t i = 0; i < mResponderInfoSize; i++)
{
Expand Down