Skip to content

Commit

Permalink
[dnssd] fix minimal mDNS resolver issues
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 committed Nov 18, 2021
1 parent 2a7eaf0 commit 90b9fb1
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/lib/dnssd/Resolver_ImplMinimalMdns.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ 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.mNumIPs++;
mNodeData.mAddress[mDiscoveredNodeData.numIPs++] = addr;
mNodeData.mInterfaceId = mInterfaceId;
mHasIP = true;
Expand Down Expand Up @@ -402,13 +403,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 90b9fb1

Please sign in to comment.