From 2ba6b068d63f26a7a932a35a105abd0a4d9951f3 Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Tue, 15 Feb 2022 22:53:49 -0500 Subject: [PATCH] Fix chip-tool resolve command to work. (#15206) Trying to use the global resolver directly only works for minimal mdns. Switch to using the supported ResolverProxy API. --- examples/chip-tool/commands/discover/Commands.h | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/examples/chip-tool/commands/discover/Commands.h b/examples/chip-tool/commands/discover/Commands.h index 2efb997f254cde..19c74f84372ea9 100644 --- a/examples/chip-tool/commands/discover/Commands.h +++ b/examples/chip-tool/commands/discover/Commands.h @@ -32,11 +32,11 @@ class Resolve : public DiscoverCommand, public chip::Dnssd::ResolverDelegate /////////// DiscoverCommand Interface ///////// CHIP_ERROR RunCommand(NodeId remoteId, uint64_t fabricId) override { - ReturnErrorOnFailure(chip::Dnssd::Resolver::Instance().Init(chip::DeviceLayer::UDPEndPointManager())); - chip::Dnssd::Resolver::Instance().SetResolverDelegate(this); + ReturnErrorOnFailure(mDNSResolver.Init(chip::DeviceLayer::UDPEndPointManager())); + mDNSResolver.SetResolverDelegate(this); ChipLogProgress(chipTool, "Dnssd: Searching for NodeId: %" PRIx64 " FabricId: %" PRIx64 " ...", remoteId, fabricId); - return chip::Dnssd::Resolver::Instance().ResolveNodeId(chip::PeerId().SetNodeId(remoteId).SetCompressedFabricId(fabricId), - chip::Inet::IPAddressType::kAny); + return mDNSResolver.ResolveNodeId(chip::PeerId().SetNodeId(remoteId).SetCompressedFabricId(fabricId), + chip::Inet::IPAddressType::kAny); } void OnNodeIdResolved(const chip::Dnssd::ResolvedNodeData & nodeData) override @@ -71,6 +71,9 @@ class Resolve : public DiscoverCommand, public chip::Dnssd::ResolverDelegate SetCommandExitStatus(CHIP_ERROR_INTERNAL); } void OnNodeDiscoveryComplete(const chip::Dnssd::DiscoveredNodeData & nodeData) override {} + +private: + chip::Dnssd::ResolverProxy mDNSResolver; }; class Update : public DiscoverCommand