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

Commit 3eb17ba

Browse files
authored
Merge pull request #617 from openweave/feature/add_wdm_ref_counter_print
Feature/add wdm ref counter print
2 parents f32715e + 23fe963 commit 3eb17ba

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

@@ -1091,6 +1100,8 @@ void SubscriptionClient::SetRetryTimer(WEAVE_ERROR aReason)
10911100
{
10921101
WEAVE_ERROR err = WEAVE_NO_ERROR;
10931102

1103+
WeaveLogDetail(DataManagement, "Client[%u] [%5.5s] %s Ref(%d)", SubscriptionEngine::GetInstance()->GetClientId(this),
1104+
GetStateStr(), __func__, mRefCount);
10941105
_AddRef();
10951106

10961107
// this check serves to see whether we already have a timer set
@@ -1167,6 +1178,9 @@ void SubscriptionClient::BindingEventCallback(void * const aAppState, const Bind
11671178
{
11681179
SubscriptionClient * const pClient = reinterpret_cast<SubscriptionClient *>(aAppState);
11691180

1181+
WeaveLogDetail(DataManagement, "Client[%u] [%5.5s] %s Ref(%d)", SubscriptionEngine::GetInstance()->GetClientId(pClient),
1182+
pClient->GetStateStr(), __func__, pClient->mRefCount);
1183+
11701184
pClient->_AddRef();
11711185

11721186
switch (aEvent)
@@ -1347,6 +1361,9 @@ void SubscriptionClient::TimerEventHandler(void)
13471361
ExitNow();
13481362
}
13491363

1364+
WeaveLogDetail(DataManagement, "Client[%u] [%5.5s] %s Ref(%d)", SubscriptionEngine::GetInstance()->GetClientId(this),
1365+
GetStateStr(), __func__, mRefCount);
1366+
13501367
// Make sure we're not freed by accident
13511368
_AddRef();
13521369

@@ -1454,6 +1471,8 @@ WEAVE_ERROR SubscriptionClient::ProcessDataList(nl::Weave::TLV::TLVReader & aRea
14541471
AlwaysAcceptDataElementAccessControlDelegate acDelegate;
14551472

14561473
#if WEAVE_CONFIG_ENABLE_WDM_UPDATE
1474+
WeaveLogDetail(DataManagement, "Client[%u] [%5.5s] %s Ref(%d)", SubscriptionEngine::GetInstance()->GetClientId(this),
1475+
GetStateStr(), __func__, mRefCount);
14571476
_AddRef();
14581477
LockUpdateMutex();
14591478
#endif // WEAVE_CONFIG_ENABLE_WDM_UPDATE
@@ -2479,6 +2498,8 @@ void SubscriptionClient::OnUpdateResponse(WEAVE_ERROR aReason, nl::Weave::Profil
24792498
bool isPathPrivate;
24802499
bool willRetryPath;
24812500

2501+
WeaveLogDetail(DataManagement, "Client[%u] [%5.5s] %s Ref(%d)", SubscriptionEngine::GetInstance()->GetClientId(this),
2502+
GetStateStr(), __func__, mRefCount);
24822503
// This method invokes callbacks into the upper layer.
24832504
_AddRef();
24842505

@@ -2773,6 +2794,8 @@ void SubscriptionClient::OnUpdateNoResponse(WEAVE_ERROR aError)
27732794
TraitPath traitPath;
27742795
WEAVE_ERROR err = WEAVE_NO_ERROR;
27752796

2797+
WeaveLogDetail(DataManagement, "Client[%u] [%5.5s] %s Ref(%d)", SubscriptionEngine::GetInstance()->GetClientId(this),
2798+
GetStateStr(), __func__, mRefCount);
27762799
_AddRef();
27772800

27782801
LockUpdateMutex();
@@ -3334,6 +3357,8 @@ WEAVE_ERROR SubscriptionClient::FlushUpdate(bool aForce)
33343357
err = SubscriptionEngine::GetInstance()->GetExchangeManager()->MessageLayer->SystemLayer->ScheduleWork(OnUpdateScheduleWorkCallback, this);
33353358
SuccessOrExit(err);
33363359

3360+
WeaveLogDetail(DataManagement, "Client[%u] [%5.5s] %s Ref(%d)", SubscriptionEngine::GetInstance()->GetClientId(this),
3361+
GetStateStr(), __func__, mRefCount);
33373362
_AddRef();
33383363
mUpdateFlushScheduled = true;
33393364

0 commit comments

Comments
 (0)