Skip to content

Commit

Permalink
Improve Subscription Liveness Logging (#15833)
Browse files Browse the repository at this point in the history
  • Loading branch information
mrjerryjohns authored and pull[bot] committed Dec 14, 2023
1 parent ce19c12 commit 04930e6
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions src/app/ReadClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -693,7 +693,10 @@ CHIP_ERROR ReadClient::RefreshLivenessCheckTimer()
System::Clock::Timeout timeout =
System::Clock::Seconds16(mMaxIntervalCeilingSeconds) + mpExchangeCtx->GetSessionHandle()->GetAckTimeout();
// EFR32/MBED/INFINION/K32W's chrono count return long unsinged, but other platform returns unsigned
ChipLogProgress(DataManagement, "Refresh LivenessCheckTime with %lu milliseconds", static_cast<long unsigned>(timeout.count()));
ChipLogProgress(
DataManagement,
"Refresh LivenessCheckTime for %lu milliseconds with SubscriptionId = 0x" ChipLogFormatX64 " Peer = %02x:" ChipLogFormatX64,
static_cast<long unsigned>(timeout.count()), ChipLogValueX64(mSubscriptionId), mFabricIndex, ChipLogValueX64(mPeerNodeId));
err = InteractionModelEngine::GetInstance()->GetExchangeManager()->GetSessionManager()->SystemLayer()->StartTimer(
timeout, OnLivenessTimeoutCallback, this);

Expand Down Expand Up @@ -728,8 +731,9 @@ void ReadClient::OnLivenessTimeoutCallback(System::Layer * apSystemLayer, void *
//
VerifyOrDie(_this->mpImEngine->InActiveReadClientList(_this));

ChipLogError(DataManagement, "Subscription Liveness timeout with subscription id 0x%" PRIx64 " peer node 0x%" PRIx64,
_this->mSubscriptionId, _this->mPeerNodeId);
ChipLogError(DataManagement,
"Subscription Liveness timeout with SubscriptionID = 0x" ChipLogFormatX64 ", Peer = %02x:" ChipLogFormatX64,
ChipLogValueX64(_this->mSubscriptionId), _this->mFabricIndex, ChipLogValueX64(_this->mPeerNodeId));

// TODO: add a more specific error here for liveness timeout failure to distinguish between other classes of timeouts (i.e
// response timeouts).
Expand All @@ -753,6 +757,13 @@ CHIP_ERROR ReadClient::ProcessSubscribeResponse(System::PacketBufferHandle && aP
VerifyOrReturnError(IsMatchingClient(subscriptionId), CHIP_ERROR_INVALID_ARGUMENT);
ReturnErrorOnFailure(subscribeResponse.GetMinIntervalFloorSeconds(&mMinIntervalFloorSeconds));
ReturnErrorOnFailure(subscribeResponse.GetMaxIntervalCeilingSeconds(&mMaxIntervalCeilingSeconds));

ChipLogProgress(DataManagement,
"Subscription established with SubscriptionID = 0x" ChipLogFormatX64 " MinInterval = %" PRIu16
"s MaxInterval = %" PRIu16 "s Peer = %02x:" ChipLogFormatX64,
ChipLogValueX64(mSubscriptionId), mMinIntervalFloorSeconds, mMaxIntervalCeilingSeconds, mFabricIndex,
ChipLogValueX64(mPeerNodeId));

ReturnErrorOnFailure(subscribeResponse.ExitContainer());
mpCallback.OnSubscriptionEstablished(subscriptionId);

Expand Down Expand Up @@ -890,8 +901,9 @@ bool ReadClient::ResubscribeIfNeeded()
}
else
{
ChipLogProgress(DataManagement, "Will try to Resubscribe at retry index %" PRIu32 " after %" PRIu32 "ms", mNumRetries,
intervalMsec);
ChipLogProgress(DataManagement,
"Will try to Resubscribe to %02x:" ChipLogFormatX64 " at retry index %" PRIu32 " after %" PRIu32 "ms",
mFabricIndex, ChipLogValueX64(mPeerNodeId), mNumRetries, intervalMsec);
}
return true;
}
Expand Down

0 comments on commit 04930e6

Please sign in to comment.