Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update address resolve interface to only use OperationalDiscovery interface #15462

Merged
merged 1 commit into from
Feb 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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