diff --git a/src/transport/GroupSession.h b/src/transport/GroupSession.h index 4114e77db212d1..f546da9772aeb3 100644 --- a/src/transport/GroupSession.h +++ b/src/transport/GroupSession.h @@ -18,48 +18,20 @@ #include #include -#include #include #include namespace chip { namespace Transport { -#ifndef NDEBUG -class GroupSessionDeleter -{ -public: - static void Release(IncomingGroupSession * entry) {} - static void Release(OutgoingGroupSession * entry) {} -}; -#endif - class IncomingGroupSession : public Session -#ifndef NDEBUG - // The group session is ephemeral, its lifespan is controlled by whoever is using it. To prevent the object being destroyed - // while there are still SessionHandle or SessionHolder pointing to it, we enforce a reference counter check at its destruction - // in debug build. - , - public ReferenceCounted -#endif { public: IncomingGroupSession(GroupId group, FabricIndex fabricIndex, NodeId sourceNodeId) : mGroupId(group), mSourceNodeId(sourceNodeId) { SetFabricIndex(fabricIndex); } - ~IncomingGroupSession() override - { - NotifySessionReleased(); -#ifndef NDEBUG - VerifyOrDie(GetReferenceCount() == 0); -#endif - } - -#ifndef NDEBUG - void Retain() override { ReferenceCounted::Retain(); } - void Release() override { ReferenceCounted::Release(); } -#endif + ~IncomingGroupSession() override { NotifySessionReleased(); } Session::SessionType GetSessionType() const override { return Session::SessionType::kGroupIncoming; } #if CHIP_PROGRESS_LOGGING @@ -102,31 +74,13 @@ class IncomingGroupSession : public Session }; class OutgoingGroupSession : public Session -#ifndef NDEBUG - // The group session is ephemeral, its lifespan is controlled by whoever is using it. To prevent the object being destroyed - // while there are still SessionHandle or SessionHolder pointing to it, we enforce a reference counter check at its destruction - // in debug build. - , - public ReferenceCounted -#endif { public: OutgoingGroupSession(GroupId group, FabricIndex fabricIndex, NodeId sourceNodeId) : mGroupId(group), mSourceNodeId(sourceNodeId) { SetFabricIndex(fabricIndex); } - ~OutgoingGroupSession() override - { - NotifySessionReleased(); -#ifndef NDEBUG - VerifyOrDie(GetReferenceCount() == 0); -#endif - } - -#ifndef NDEBUG - void Retain() override { ReferenceCounted::Retain(); } - void Release() override { ReferenceCounted::Release(); } -#endif + ~OutgoingGroupSession() override { NotifySessionReleased(); } Session::SessionType GetSessionType() const override { return Session::SessionType::kGroupOutgoing; } #if CHIP_PROGRESS_LOGGING