From 8b74520d33e22fbb0536f9aed37bb17b2196dc48 Mon Sep 17 00:00:00 2001 From: Zang MingJie Date: Thu, 5 May 2022 19:16:04 +0800 Subject: [PATCH] Resolve comments --- src/protocols/secure_channel/PairingSession.cpp | 4 ++-- src/protocols/secure_channel/PairingSession.h | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/protocols/secure_channel/PairingSession.cpp b/src/protocols/secure_channel/PairingSession.cpp index 51011bd2dcf3e8..8761ac9f6c0a0c 100644 --- a/src/protocols/secure_channel/PairingSession.cpp +++ b/src/protocols/secure_channel/PairingSession.cpp @@ -61,7 +61,7 @@ void PairingSession::Finish() { Transport::PeerAddress address = mExchangeCtxt->GetSessionHandle()->AsUnauthenticatedSession()->GetPeerAddress(); - // Discard the exchange so that Clear() doesn't try closing it. The exchange will handle that. + // Discard the exchange so that our subclasses don't try closing it. The exchange will handle that. DiscardExchange(); CHIP_ERROR err = ActivateSecureSession(address); @@ -104,7 +104,7 @@ void PairingSession::DiscardExchange() // Make sure the exchange doesn't try to notify us when it closes, // since we might be dead by then. mExchangeCtxt->SetDelegate(nullptr); - // Null out mExchangeCtxt so that Clear() doesn't try closing it. The + // Null out mExchangeCtxt so that our subclasses don't try closing it. The // exchange will handle that. mExchangeCtxt = nullptr; } diff --git a/src/protocols/secure_channel/PairingSession.h b/src/protocols/secure_channel/PairingSession.h index 5aaa9f7ddb9785..10c598f73c3717 100644 --- a/src/protocols/secure_channel/PairingSession.h +++ b/src/protocols/secure_channel/PairingSession.h @@ -98,9 +98,9 @@ class DLL_EXPORT PairingSession void Finish(); - void AbortExchange(); - void CloseExchange(); - void DiscardExchange(); + void AbortExchange(); // Called when error happens, terminate the pairing. + void CloseExchange(); // Called inside `Clear` to guarentee that the exchange is not leaked. + void DiscardExchange(); // Clear our reference to our exchange context pointer so that it can close itself at some later time. void SetPeerSessionId(uint16_t id) { mPeerSessionId.SetValue(id); } virtual void OnSuccessStatusReport() {}