Skip to content
This repository was archived by the owner on Dec 20, 2023. It is now read-only.

Commit 23fe963

Browse files
Add detailed ref counting print for wdm subscription
-- Previousl subscription has detailed ref counter print, we extend this print for wdm update. -- Add detailed print for release
1 parent 097e6a2 commit 23fe963

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

src/lib/profiles/data-management/Current/SubscriptionClient.cpp

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,8 @@ WEAVE_ERROR SubscriptionClient::Init(Binding * const apBinding, void * const apA
149149
#endif // WEAVE_CONFIG_ENABLE_WDM_UPDATE
150150
MoveToState(kState_Initialized);
151151

152+
WeaveLogDetail(DataManagement, "Client[%u] [%5.5s] %s Ref(%d)", SubscriptionEngine::GetInstance()->GetClientId(this),
153+
GetStateStr(), __func__, mRefCount);
152154
_AddRef();
153155

154156
#if WEAVE_CONFIG_ENABLE_WDM_UPDATE
@@ -427,6 +429,8 @@ WEAVE_ERROR SubscriptionClient::_PrepareBinding()
427429
{
428430
WEAVE_ERROR err = WEAVE_NO_ERROR;
429431

432+
WeaveLogDetail(DataManagement, "Client[%u] [%5.5s] %s Ref(%d)", SubscriptionEngine::GetInstance()->GetClientId(this),
433+
GetStateStr(), __func__, mRefCount);
430434
_AddRef();
431435

432436
if (mBinding->IsReady())
@@ -778,6 +782,9 @@ void SubscriptionClient::_Release()
778782
{
779783
--mRefCount;
780784
}
785+
786+
WeaveLogDetail(DataManagement, "Client[%u] [%5.5s] %s Ref(%d)", SubscriptionEngine::GetInstance()->GetClientId(this),
787+
GetStateStr(), __func__, mRefCount);
781788
}
782789

783790
Binding * SubscriptionClient::GetBinding() const
@@ -796,6 +803,8 @@ WEAVE_ERROR SubscriptionClient::ReplaceExchangeContext()
796803
InEventParam inParam;
797804
OutEventParam outParam;
798805

806+
WeaveLogDetail(DataManagement, "Client[%u] [%5.5s] %s Ref(%d)", SubscriptionEngine::GetInstance()->GetClientId(this),
807+
GetStateStr(), __func__, mRefCount);
799808
// Make sure we're not freed by accident.
800809
_AddRef();
801810

@@ -1088,6 +1097,8 @@ void SubscriptionClient::SetRetryTimer(WEAVE_ERROR aReason)
10881097
{
10891098
WEAVE_ERROR err = WEAVE_NO_ERROR;
10901099

1100+
WeaveLogDetail(DataManagement, "Client[%u] [%5.5s] %s Ref(%d)", SubscriptionEngine::GetInstance()->GetClientId(this),
1101+
GetStateStr(), __func__, mRefCount);
10911102
_AddRef();
10921103

10931104
// this check serves to see whether we already have a timer set
@@ -1164,6 +1175,9 @@ void SubscriptionClient::BindingEventCallback(void * const aAppState, const Bind
11641175
{
11651176
SubscriptionClient * const pClient = reinterpret_cast<SubscriptionClient *>(aAppState);
11661177

1178+
WeaveLogDetail(DataManagement, "Client[%u] [%5.5s] %s Ref(%d)", SubscriptionEngine::GetInstance()->GetClientId(pClient),
1179+
pClient->GetStateStr(), __func__, pClient->mRefCount);
1180+
11671181
pClient->_AddRef();
11681182

11691183
switch (aEvent)
@@ -1344,6 +1358,9 @@ void SubscriptionClient::TimerEventHandler(void)
13441358
ExitNow();
13451359
}
13461360

1361+
WeaveLogDetail(DataManagement, "Client[%u] [%5.5s] %s Ref(%d)", SubscriptionEngine::GetInstance()->GetClientId(this),
1362+
GetStateStr(), __func__, mRefCount);
1363+
13471364
// Make sure we're not freed by accident
13481365
_AddRef();
13491366

@@ -1451,6 +1468,8 @@ WEAVE_ERROR SubscriptionClient::ProcessDataList(nl::Weave::TLV::TLVReader & aRea
14511468
AlwaysAcceptDataElementAccessControlDelegate acDelegate;
14521469

14531470
#if WEAVE_CONFIG_ENABLE_WDM_UPDATE
1471+
WeaveLogDetail(DataManagement, "Client[%u] [%5.5s] %s Ref(%d)", SubscriptionEngine::GetInstance()->GetClientId(this),
1472+
GetStateStr(), __func__, mRefCount);
14541473
_AddRef();
14551474
LockUpdateMutex();
14561475
#endif // WEAVE_CONFIG_ENABLE_WDM_UPDATE
@@ -2476,6 +2495,8 @@ void SubscriptionClient::OnUpdateResponse(WEAVE_ERROR aReason, nl::Weave::Profil
24762495
bool isPathPrivate;
24772496
bool willRetryPath;
24782497

2498+
WeaveLogDetail(DataManagement, "Client[%u] [%5.5s] %s Ref(%d)", SubscriptionEngine::GetInstance()->GetClientId(this),
2499+
GetStateStr(), __func__, mRefCount);
24792500
// This method invokes callbacks into the upper layer.
24802501
_AddRef();
24812502

@@ -2769,6 +2790,8 @@ void SubscriptionClient::OnUpdateNoResponse(WEAVE_ERROR aError)
27692790
TraitPath traitPath;
27702791
WEAVE_ERROR err = WEAVE_NO_ERROR;
27712792

2793+
WeaveLogDetail(DataManagement, "Client[%u] [%5.5s] %s Ref(%d)", SubscriptionEngine::GetInstance()->GetClientId(this),
2794+
GetStateStr(), __func__, mRefCount);
27722795
_AddRef();
27732796

27742797
LockUpdateMutex();
@@ -3330,6 +3353,8 @@ WEAVE_ERROR SubscriptionClient::FlushUpdate(bool aForce)
33303353
err = SubscriptionEngine::GetInstance()->GetExchangeManager()->MessageLayer->SystemLayer->ScheduleWork(OnUpdateScheduleWorkCallback, this);
33313354
SuccessOrExit(err);
33323355

3356+
WeaveLogDetail(DataManagement, "Client[%u] [%5.5s] %s Ref(%d)", SubscriptionEngine::GetInstance()->GetClientId(this),
3357+
GetStateStr(), __func__, mRefCount);
33333358
_AddRef();
33343359
mUpdateFlushScheduled = true;
33353360

0 commit comments

Comments
 (0)