Skip to content

Commit

Permalink
Restyled by clang-format
Browse files Browse the repository at this point in the history
  • Loading branch information
restyled-commits committed Apr 22, 2022
1 parent e32156d commit 982a99a
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 19 deletions.
29 changes: 15 additions & 14 deletions src/transport/SecureSession.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,23 +28,24 @@ void SecureSessionDeleter::Release(SecureSession * entry)

void SecureSession::MarkForRemoval()
{
ChipLogDetail(Inet, "SecureSession MarkForRemoval %p Type:%d LSID:%d", this, static_cast<int>(mSecureSessionType), mLocalSessionId);
ChipLogDetail(Inet, "SecureSession MarkForRemoval %p Type:%d LSID:%d", this, static_cast<int>(mSecureSessionType),
mLocalSessionId);
ReferenceCountedHandle<Transport::Session> ref(*this);
switch (mState)
{
case State::kPairing:
mState = State::kPendingRemoval;
// Interrupt the pairing
NotifySessionReleased();
return;
case State::kActive:
Release(); // Decrease the ref which is retained at Activate
mState = State::kPendingRemoval;
NotifySessionReleased();
return;
case State::kPendingRemoval:
// Do nothing
return;
case State::kPairing:
mState = State::kPendingRemoval;
// Interrupt the pairing
NotifySessionReleased();
return;
case State::kActive:
Release(); // Decrease the ref which is retained at Activate
mState = State::kPendingRemoval;
NotifySessionReleased();
return;
case State::kPendingRemoval:
// Do nothing
return;
}
}

Expand Down
12 changes: 8 additions & 4 deletions src/transport/SecureSession.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ class SecureSession : public Session, public ReferenceCounted<SecureSession, Sec
{
Retain(); // Put the test session in Active state
SetFabricIndex(fabric);
ChipLogDetail(Inet, "SecureSession Allocated for test %p Type:%d LSID:%d", this, static_cast<int>(mSecureSessionType), mLocalSessionId);
ChipLogDetail(Inet, "SecureSession Allocated for test %p Type:%d LSID:%d", this, static_cast<int>(mSecureSessionType),
mLocalSessionId);
}

/**
Expand All @@ -88,7 +89,8 @@ class SecureSession : public Session, public ReferenceCounted<SecureSession, Sec
SecureSession(SecureSessionTable & table, Type secureSessionType, uint16_t localSessionId) :
mTable(table), mState(State::kPairing), mSecureSessionType(secureSessionType), mLocalSessionId(localSessionId)
{
ChipLogDetail(Inet, "SecureSession Allocated %p Type:%d LSID:%d", this, static_cast<int>(mSecureSessionType), mLocalSessionId);
ChipLogDetail(Inet, "SecureSession Allocated %p Type:%d LSID:%d", this, static_cast<int>(mSecureSessionType),
mLocalSessionId);
}

/**
Expand All @@ -110,8 +112,10 @@ class SecureSession : public Session, public ReferenceCounted<SecureSession, Sec
mState = State::kActive;
ChipLogDetail(Inet, "SecureSession Active %p Type:%d LSID:%d", this, static_cast<int>(mSecureSessionType), mLocalSessionId);
}
~SecureSession() override {
ChipLogDetail(Inet, "SecureSession Released %p Type:%d LSID:%d", this, static_cast<int>(mSecureSessionType), mLocalSessionId);
~SecureSession() override
{
ChipLogDetail(Inet, "SecureSession Released %p Type:%d LSID:%d", this, static_cast<int>(mSecureSessionType),
mLocalSessionId);
}

SecureSession(SecureSession &&) = delete;
Expand Down
3 changes: 2 additions & 1 deletion src/transport/SessionManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -779,7 +779,8 @@ Optional<SessionHandle> SessionManager::FindSecureSessionForNode(ScopedNodeId pe
{
SecureSession * found = nullptr;
mSecureSessions.ForEachSession([&peerNodeId, &type, &found](auto session) {
if (session->IsActiveSession() && session->GetPeer() == peerNodeId && (!type.HasValue() || type.Value() == session->GetSecureSessionType()))
if (session->IsActiveSession() && session->GetPeer() == peerNodeId &&
(!type.HasValue() || type.Value() == session->GetSecureSessionType()))
{
found = session;
return Loop::Break;
Expand Down

0 comments on commit 982a99a

Please sign in to comment.