Skip to content

Commit

Permalink
Mark that address resolve is only implementing operational node disco…
Browse files Browse the repository at this point in the history
…very (#15462)
  • Loading branch information
andy31415 authored and pull[bot] committed Jun 26, 2023
1 parent 1b80882 commit 3409460
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 17 deletions.
15 changes: 3 additions & 12 deletions src/lib/address_resolve/AddressResolve_DefaultImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,11 +178,11 @@ CHIP_ERROR Resolver::LookupNode(const NodeLookupRequest & request, Impl::NodeLoo
CHIP_ERROR Resolver::Init(System::Layer * systemLayer)
{
mSystemLayer = systemLayer;
Dnssd::Resolver::Instance().SetResolverDelegate(this);
Dnssd::Resolver::Instance().SetOperationalDelegate(this);
return CHIP_NO_ERROR;
}

void Resolver::OnNodeIdResolved(const Dnssd::ResolvedNodeData & nodeData)
void Resolver::OnOperationalNodeResolved(const Dnssd::ResolvedNodeData & nodeData)
{
auto it = mActiveLookups.begin();
while (it != mActiveLookups.end())
Expand Down Expand Up @@ -230,7 +230,7 @@ void Resolver::HandleTimer()
ReArmTimer();
}

void Resolver::OnNodeIdResolutionFailed(const PeerId & peerId, CHIP_ERROR error)
void Resolver::OnOperationalNodeResolutionFailed(const PeerId & peerId, CHIP_ERROR error)
{
auto it = mActiveLookups.begin();
while (it != mActiveLookups.end())
Expand Down Expand Up @@ -288,15 +288,6 @@ void Resolver::ReArmTimer()
}
}

void Resolver::OnNodeDiscoveryComplete(const Dnssd::DiscoveredNodeData & nodeData)
{
// This is for Commissionable discovery and such lookup is not performed by
// the address resolver.
//
// Getting this callback likely means that linkages of delegates is not done correctly.
ChipLogError(Discovery, "UNEXPECTED/UNIMPLEMENTED commissionable discovery callback");
}

} // namespace Impl

Resolver & Resolver::Instance()
Expand Down
9 changes: 4 additions & 5 deletions src/lib/address_resolve/AddressResolve_DefaultImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class NodeLookupHandle : public NodeLookupHandleBase
unsigned mBestAddressScore = 0;
};

class Resolver : public ::chip::AddressResolve::Resolver, public Dnssd::ResolverDelegate
class Resolver : public ::chip::AddressResolve::Resolver, public Dnssd::OperationalResolveDelegate
{
public:
virtual ~Resolver() = default;
Expand All @@ -81,11 +81,10 @@ class Resolver : public ::chip::AddressResolve::Resolver, public Dnssd::Resolver
CHIP_ERROR Init(System::Layer * systemLayer) override;
CHIP_ERROR LookupNode(const NodeLookupRequest & request, Impl::NodeLookupHandle & handle) override;

// Dnssd::ResolverDelegate
// Dnssd::OperationalResolveDelegate

void OnNodeIdResolved(const Dnssd::ResolvedNodeData & nodeData) override;
void OnNodeIdResolutionFailed(const PeerId & peerId, CHIP_ERROR error) override;
void OnNodeDiscoveryComplete(const Dnssd::DiscoveredNodeData & nodeData) override;
void OnOperationalNodeResolved(const Dnssd::ResolvedNodeData & nodeData) override;
void OnOperationalNodeResolutionFailed(const PeerId & peerId, CHIP_ERROR error) override;

private:
static void OnResolveTimer(System::Layer * layer, void * context) { static_cast<Resolver *>(context)->HandleTimer(); }
Expand Down

0 comments on commit 3409460

Please sign in to comment.