Skip to content

Commit 3911907

Browse files
gjc13pull[bot]
authored andcommitted
[dnssd] fix minimal mDNS resolver issues (#11963)
* Fix initialization with advertiser * Fix wrong IP number in resolution result
1 parent 04cf507 commit 3911907

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/lib/dnssd/Resolver_ImplMinimalMdns.cpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -176,9 +176,9 @@ void PacketDataReporter::OnOperationalIPAddress(const chip::Inet::IPAddress & ad
176176
// This code assumes that all entries in the mDNS packet relate to the
177177
// same entity. This may not be correct if multiple servers are reported
178178
// (if multi-admin decides to use unique ports for every ecosystem).
179-
mNodeData.mAddress[mDiscoveredNodeData.numIPs++] = addr;
180-
mNodeData.mInterfaceId = mInterfaceId;
181-
mHasIP = true;
179+
mNodeData.mAddress[mNodeData.mNumIPs++] = addr;
180+
mNodeData.mInterfaceId = mInterfaceId;
181+
mHasIP = true;
182182
}
183183

184184
void PacketDataReporter::OnDiscoveredNodeIPAddress(const chip::Inet::IPAddress & addr)
@@ -402,13 +402,13 @@ CHIP_ERROR MinMdnsResolver::Init(chip::Inet::InetLayer * inetLayer)
402402
{
403403
/// Note: we do not double-check the port as we assume the APP will always use
404404
/// the same inetLayer and port for mDNS.
405+
mSystemLayer = inetLayer->SystemLayer();
406+
405407
if (GlobalMinimalMdnsServer::Server().IsListening())
406408
{
407409
return CHIP_NO_ERROR;
408410
}
409411

410-
mSystemLayer = inetLayer->SystemLayer();
411-
412412
return GlobalMinimalMdnsServer::Instance().StartServer(inetLayer, kMdnsPort);
413413
}
414414

0 commit comments

Comments
 (0)