Skip to content

Commit

Permalink
Address review comments from PR #21660. (#22353)
Browse files Browse the repository at this point in the history
Fixes #22352
  • Loading branch information
bzbarsky-apple authored and pull[bot] committed Nov 2, 2022
1 parent 424422b commit c222ff5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
10 changes: 4 additions & 6 deletions src/app/ReadClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,10 @@ void ReadClient::StopResubscription()

ReadClient::~ReadClient()
{
Close(CHIP_NO_ERROR, /* allowResubscription = */ false, /* allowOnDone = */ false);
if (IsSubscriptionType())
{
StopResubscription();

// Only remove ourselves from the engine's tracker list if we still continue to have a valid pointer to it.
// This won't be the case if the engine shut down before this destructor was called (in which case, mpImEngine
// will point to null)
Expand Down Expand Up @@ -150,7 +151,7 @@ CHIP_ERROR ReadClient::ScheduleResubscription(uint32_t aTimeTillNextResubscripti
return CHIP_NO_ERROR;
}

void ReadClient::Close(CHIP_ERROR aError, bool allowResubscription, bool allowOnDone)
void ReadClient::Close(CHIP_ERROR aError, bool allowResubscription)
{
if (IsReadType())
{
Expand Down Expand Up @@ -192,10 +193,7 @@ void ReadClient::Close(CHIP_ERROR aError, bool allowResubscription, bool allowOn

mExchange.Release();

if (allowOnDone)
{
mpCallback.OnDone(this);
}
mpCallback.OnDone(this);
}

const char * ReadClient::GetStateStr() const
Expand Down
4 changes: 1 addition & 3 deletions src/app/ReadClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -474,10 +474,8 @@ class ReadClient : public Messaging::ExchangeDelegate
* If aError != CHIP_NO_ERROR, this will trigger re-subscriptions if allowResubscription is true
* AND if this ReadClient instance is tracking a subscription AND the applications decides to do so
* in their implementation of Callback::OnResubscriptionNeeded().
*
* If allowOnDone is false, will not call OnDone.
*/
void Close(CHIP_ERROR aError, bool allowResubscription = true, bool allowOnDone = true);
void Close(CHIP_ERROR aError, bool allowResubscription = true);

void StopResubscription();
void ClearActiveSubscriptionState();
Expand Down

0 comments on commit c222ff5

Please sign in to comment.