Skip to content

Commit

Permalink
[binding] Fix missing callback when notifying a connecting device (#1…
Browse files Browse the repository at this point in the history
  • Loading branch information
gjc13 authored Mar 24, 2022
1 parent dad6375 commit be4abbe
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/app/clusters/bindings/BindingManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ void BindingManager::FabricRemoved(CompressedFabricId compressedFabricId, Fabric
CHIP_ERROR BindingManager::NotifyBoundClusterChanged(EndpointId endpoint, ClusterId cluster, void * context)
{
VerifyOrReturnError(mInitParams.mFabricTable != nullptr, CHIP_ERROR_INCORRECT_STATE);
VerifyOrReturnError(mBoundDeviceChangedHandler, CHIP_NO_ERROR);

for (auto iter = BindingTable::GetInstance().begin(); iter != BindingTable::GetInstance().end(); ++iter)
{
Expand All @@ -199,18 +200,15 @@ CHIP_ERROR BindingManager::NotifyBoundClusterChanged(EndpointId endpoint, Cluste
VerifyOrReturnError(fabricInfo != nullptr, CHIP_ERROR_NOT_FOUND);
PeerId peer = fabricInfo->GetPeerIdForNode(iter->nodeId);
OperationalDeviceProxy * peerDevice = mInitParams.mCASESessionManager->FindExistingSession(peer);
if (peerDevice != nullptr && peerDevice->IsConnected() && mBoundDeviceChangedHandler)
if (peerDevice != nullptr && peerDevice->IsConnected())
{
// We already have an active connection
mBoundDeviceChangedHandler(*iter, peerDevice, context);
}
else
{
mPendingNotificationMap.AddPendingNotification(iter.GetIndex(), context);
if (peerDevice == nullptr || !peerDevice->IsConnecting())
{
ReturnErrorOnFailure(EstablishConnection(iter->fabricIndex, iter->nodeId));
}
ReturnErrorOnFailure(EstablishConnection(iter->fabricIndex, iter->nodeId));
}
}
else if (iter->type == EMBER_MULTICAST_BINDING)
Expand Down

0 comments on commit be4abbe

Please sign in to comment.