Skip to content

Commit

Permalink
Make CASESessionManager the resolver delegate if ResolverProxy is not…
Browse files Browse the repository at this point in the history
… passed in (#12864)
  • Loading branch information
carol-apple authored and pull[bot] committed Nov 28, 2023
1 parent 5899faa commit 83bd8d5
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 3 deletions.
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

0 comments on commit 83bd8d5

Please sign in to comment.