From 1322848cbf8228f294ea40a74ff5530847481ba6 Mon Sep 17 00:00:00 2001 From: Jiacheng Guo Date: Mon, 22 Nov 2021 17:19:20 +0800 Subject: [PATCH] [dnssd] fix minimal mDNS resolver issues (#11963) * Fix initialization with advertiser * Fix wrong IP number in resolution result --- src/lib/dnssd/Resolver_ImplMinimalMdns.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/lib/dnssd/Resolver_ImplMinimalMdns.cpp b/src/lib/dnssd/Resolver_ImplMinimalMdns.cpp index 2345c99c4e1946..7b4a34a409fc26 100644 --- a/src/lib/dnssd/Resolver_ImplMinimalMdns.cpp +++ b/src/lib/dnssd/Resolver_ImplMinimalMdns.cpp @@ -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) @@ -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); }