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

Make CASESessionManager the resolver delegate if ResolverProxy is not passed in #12864

Merged
merged 1 commit into from
Dec 10, 2021
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
12 changes: 9 additions & 3 deletions src/app/CASESessionManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include <lib/core/CHIPCore.h>
#include <lib/dnssd/DnssdCache.h>
#include <lib/support/Pool.h>
#include <platform/CHIPDeviceLayer.h>
#include <transport/SessionDelegate.h>

#include <lib/dnssd/ResolverProxy.h>
Expand Down Expand Up @@ -58,11 +59,15 @@ class CASESessionManager : public SessionReleaseDelegate, public Dnssd::Resolver

mConfig = params;

// TODO: Revisit who should be set as the resolver delegate
Dnssd::Resolver::Instance().SetResolverDelegate(this);
if (mConfig.dnsResolver == nullptr)
{
VerifyOrDie(mDNSResolver.Init(DeviceLayer::UDPEndPointManager()) == CHIP_NO_ERROR);
mDNSResolver.SetResolverDelegate(this);
mConfig.dnsResolver = &mDNSResolver;
}
}

virtual ~CASESessionManager() {}
virtual ~CASESessionManager() { mDNSResolver.Shutdown(); }

/**
* Find an existing session for the given node ID, or trigger a new session request.
Expand Down Expand Up @@ -109,6 +114,7 @@ class CASESessionManager : public SessionReleaseDelegate, public Dnssd::Resolver
void ReleaseSession(OperationalDeviceProxy * device);

CASESessionManagerConfig mConfig;
Dnssd::ResolverProxy mDNSResolver;
};

} // namespace chip
17 changes: 17 additions & 0 deletions src/lib/dnssd/Resolver_ImplNone.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

#include "Resolver.h"

#include <lib/dnssd/ResolverProxy.h>
#include <lib/support/logging/CHIPLogging.h>

namespace chip {
Expand Down Expand Up @@ -47,5 +48,21 @@ Resolver & chip::Dnssd::Resolver::Instance()
{
return gResolver;
}

CHIP_ERROR ResolverProxy::ResolveNodeId(const PeerId & peerId, Inet::IPAddressType type, Resolver::CacheBypass dnssdCacheBypass)
{
return CHIP_ERROR_NOT_IMPLEMENTED;
}

CHIP_ERROR ResolverProxy::FindCommissionableNodes(DiscoveryFilter filter)
{
return CHIP_ERROR_NOT_IMPLEMENTED;
}

CHIP_ERROR ResolverProxy::FindCommissioners(DiscoveryFilter filter)
{
return CHIP_ERROR_NOT_IMPLEMENTED;
}

} // namespace Dnssd
} // namespace chip