Skip to content

Commit

Permalink
Integrating comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Alami-Amine committed Oct 21, 2024
1 parent 7cb692f commit dd11eaf
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions src/protocols/secure_channel/PASESession.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -232,18 +232,15 @@ CHIP_ERROR PASESession::Pair(SessionManager & sessionManager, uint32_t peerSetUp
exit:
if (err != CHIP_NO_ERROR)
{
// If a failure happens in PASESession::Init, we need to ensure that the passed exchange context is closed to prevent
// resource leaks.
exchangeCtxt->Close();

// If a failure happens in SendPBKDFParamRequest, we need to Discard the exchange (mExchangeCtxt) so that Clear() doesn't
// try closing it. The exchange will handle that.
DiscardExchange();
// If a failure happens before we have placed the incoming exchange into `mExchangeCtxt`, we need to make
// sure to close the exchange to fulfill our API contract.
if (!mExchangeCtxt.HasValue())
{
exchangeCtxt->Close();
}
Clear();
ChipLogError(SecureChannel, "Failed during PASE session pairing request: %" CHIP_ERROR_FORMAT, err.Format());
MATTER_TRACE_COUNTER("PASEFail");
// Do this last in case the delegate frees us.
NotifySessionEstablishmentError(err);
}
return err;
}
Expand Down

0 comments on commit dd11eaf

Please sign in to comment.