Skip to content

Commit

Permalink
[dnssd] fix minimal mDNS resolver issues (#11963)
Browse files Browse the repository at this point in the history
* Fix initialization with advertiser
* Fix wrong IP number in resolution result
  • Loading branch information
gjc13 authored and pull[bot] committed Aug 5, 2022
1 parent 66c3cc4 commit 1322848
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/lib/dnssd/Resolver_ImplMinimalMdns.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,9 +176,9 @@ void PacketDataReporter::OnOperationalIPAddress(const chip::Inet::IPAddress & ad
// This code assumes that all entries in the mDNS packet relate to the
// same entity. This may not be correct if multiple servers are reported
// (if multi-admin decides to use unique ports for every ecosystem).
mNodeData.mAddress[mDiscoveredNodeData.numIPs++] = addr;
mNodeData.mInterfaceId = mInterfaceId;
mHasIP = true;
mNodeData.mAddress[mNodeData.mNumIPs++] = addr;
mNodeData.mInterfaceId = mInterfaceId;
mHasIP = true;
}

void PacketDataReporter::OnDiscoveredNodeIPAddress(const chip::Inet::IPAddress & addr)
Expand Down Expand Up @@ -402,13 +402,13 @@ CHIP_ERROR MinMdnsResolver::Init(chip::Inet::InetLayer * inetLayer)
{
/// Note: we do not double-check the port as we assume the APP will always use
/// the same inetLayer and port for mDNS.
mSystemLayer = inetLayer->SystemLayer();

if (GlobalMinimalMdnsServer::Server().IsListening())
{
return CHIP_NO_ERROR;
}

mSystemLayer = inetLayer->SystemLayer();

return GlobalMinimalMdnsServer::Instance().StartServer(inetLayer, kMdnsPort);
}

Expand Down

0 comments on commit 1322848

Please sign in to comment.