Skip to content

Commit

Permalink
[controller] Don't release admin on failed rendezvous (#5300)
Browse files Browse the repository at this point in the history
Admin ID is released on failed rendezvous session although
it's only assigned once during the device controller
initialization. As a result, it's impossible to pair another
device if the previous rendezvous returned an error.

Release the admin on the device controller shutdown, instead.
  • Loading branch information
Damian-Nordic authored Mar 10, 2021
1 parent 7d14b5b commit 312438f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
2 changes: 2 additions & 0 deletions src/controller/CHIPDeviceController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,8 @@ CHIP_ERROR DeviceController::Shutdown()
mTransportMgr = nullptr;
}

mAdmins.ReleaseAdminId(mAdminId);

ReleaseAllDevices();
return CHIP_NO_ERROR;
}
Expand Down
12 changes: 2 additions & 10 deletions src/transport/RendezvousSession.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -322,17 +322,9 @@ void RendezvousSession::UpdateState(RendezvousSession::State newState, CHIP_ERRO
mTransport = nullptr;
}

if (CHIP_NO_ERROR != err)
if (CHIP_NO_ERROR != err && mDelegate != nullptr)
{
if (mAdmin != nullptr)
{
mAdmin->Reset();
}

if (mDelegate)
{
mDelegate->OnRendezvousError(err);
}
mDelegate->OnRendezvousError(err);
}
break;

Expand Down

0 comments on commit 312438f

Please sign in to comment.