Skip to content

Commit

Permalink
Fix chip-tool resolve command to work. (#15206)
Browse files Browse the repository at this point in the history
Trying to use the global resolver directly only works for minimal mdns.
Switch to using the supported ResolverProxy API.
  • Loading branch information
bzbarsky-apple authored and pull[bot] committed Aug 10, 2023
1 parent 925833a commit 4799688
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions examples/chip-tool/commands/discover/Commands.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 4799688

Please sign in to comment.