Skip to content

Commit

Permalink
fix pairing issues
Browse files Browse the repository at this point in the history
  • Loading branch information
gjc13 committed Dec 10, 2021
1 parent d0b3ddb commit b6d0022
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 12 deletions.
14 changes: 14 additions & 0 deletions src/app/CASESessionManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,23 @@
*/

#include <app/CASESessionManager.h>
#include <platform/CHIPDeviceLayer.h>

namespace chip {

CASESessionManager::CASESessionManager(CASESessionManagerConfig & params)
{
VerifyOrDie(params.sessionInitParams.Validate() == CHIP_NO_ERROR);

if (params.dnsResolver == nullptr)
{
mDNSResolver.Init(DeviceLayer::UDPEndPointManager());
params.dnsResolver = &mDNSResolver;
params.dnsResolver->SetResolverDelegate(this);
}
mConfig = params;
}

CHIP_ERROR CASESessionManager::FindOrEstablishSession(FabricInfo * fabric, NodeId nodeId,
Callback::Callback<OnDeviceConnected> * onConnection,
Callback::Callback<OnDeviceConnectionFailure> * onFailure)
Expand Down
11 changes: 2 additions & 9 deletions src/app/CASESessionManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,7 @@ class CASESessionManager : public SessionReleaseDelegate, public Dnssd::Resolver
public:
CASESessionManager() = delete;

CASESessionManager(CASESessionManagerConfig & params)
{
VerifyOrDie(params.sessionInitParams.Validate() == CHIP_NO_ERROR);

mConfig = params;

// TODO: Revisit who should be set as the resolver delegate
params.dnsResolver->SetResolverDelegate(this);
}
CASESessionManager(CASESessionManagerConfig & params);

virtual ~CASESessionManager() {}

Expand Down Expand Up @@ -109,6 +101,7 @@ class CASESessionManager : public SessionReleaseDelegate, public Dnssd::Resolver
void ReleaseSession(OperationalDeviceProxy * device);

CASESessionManagerConfig mConfig;
Dnssd::ResolverProxy mDNSResolver;
};

} // namespace chip
3 changes: 1 addition & 2 deletions src/app/server/Server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,6 @@ CHIP_ERROR Server::Init(AppDelegate * delegate, uint16_t secureServicePort, uint

CHIP_ERROR Server::InitCASESessionManager()
{
ReturnErrorOnFailure(mDNSResolver.Init(DeviceLayer::UDPEndPointManager()));
DeviceProxyInitParams initParams = {
.sessionManager = &mSessions,
.exchangeMgr = &mExchangeMgr,
Expand All @@ -246,7 +245,7 @@ CHIP_ERROR Server::InitCASESessionManager()
.sessionInitParams = initParams,
.dnsCache = nullptr,
.devicePool = &mDevicePool,
.dnsResolver = &mDNSResolver,
.dnsResolver = nullptr,
};
mCASESessionManager = new (&mCASESessionManagerStorage) CASESessionManager(sessionManagerConfig);

Expand Down
1 change: 0 additions & 1 deletion src/app/server/Server.h
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,6 @@ class Server
CASESessionManager * mCASESessionManager;
CASEClientPool<kCASEClientPoolSize> mCASEClientPool;
OperationalDeviceProxyPool<kOperationalDevicePoolSize> mDevicePool;
Dnssd::ResolverProxy mDNSResolver;

Messaging::ExchangeManager mExchangeMgr;
FabricTable mFabrics;
Expand Down

0 comments on commit b6d0022

Please sign in to comment.