@@ -129,9 +129,18 @@ void ReliableMessageMgr::ExecuteActions()
129
129
130
130
VerifyOrDie (!entry->retainedBuf .IsNull ());
131
131
132
+ // Don't check whether the session in the exchange is valid, because when the session is released, the retrans entry is
133
+ // cleared inside ExchangeContext::OnSessionReleased, so the session must be valid if the entry exists.
134
+ auto session = entry->ec ->GetSessionHandle ();
132
135
uint8_t sendCount = entry->sendCount ;
133
- #if CHIP_ERROR_LOGGING || CHIP_DETAIL_LOGGING
136
+ #if CHIP_ERROR_LOGGING || CHIP_PROGRESS_LOGGING
134
137
uint32_t messageCounter = entry->retainedBuf .GetMessageCounter ();
138
+ auto fabricIndex = session->GetFabricIndex ();
139
+ auto destination = kUndefinedNodeId ;
140
+ if (session->IsSecureSession ())
141
+ {
142
+ destination = session->AsSecureSession ()->GetPeerNodeId ();
143
+ }
135
144
#endif // CHIP_ERROR_LOGGING || CHIP_DETAIL_LOGGING
136
145
137
146
if (sendCount == CHIP_CONFIG_RMP_DEFAULT_MAX_RETRANS)
@@ -140,13 +149,11 @@ void ReliableMessageMgr::ExecuteActions()
140
149
ExchangeHandle ec (entry->ec );
141
150
142
151
ChipLogError (ExchangeManager,
143
- " Failed to Send CHIP MessageCounter:" ChipLogFormatMessageCounter " on exchange " ChipLogFormatExchange
144
- " sendCount: %u max retries: %d" ,
145
- messageCounter, ChipLogValueExchange (&ec.Get ()), sendCount, CHIP_CONFIG_RMP_DEFAULT_MAX_RETRANS);
146
-
147
- // Don't check whether the session in the exchange is valid, because when the session is released, the retrans entry is
148
- // cleared inside ExchangeContext::OnSessionReleased, so the session must be valid if the entry exists.
149
- SessionHandle session = ec->GetSessionHandle ();
152
+ " <<%d [E:" ChipLogFormatExchange " S:%u M:" ChipLogFormatMessageCounter
153
+ " ] (%s) Msg Retransmission to %u:" ChipLogFormatX64 " failure (max retries:%d)" ,
154
+ sendCount + 1 , ChipLogValueExchange (&entry->ec .Get ()), session->SessionIdForLogging (), messageCounter,
155
+ Transport::GetSessionTypeString (session), fabricIndex, ChipLogValueX64 (destination),
156
+ CHIP_CONFIG_RMP_DEFAULT_MAX_RETRANS);
150
157
151
158
// If the exchange is expecting a response, it will handle sending
152
159
// this notification once it detects that it has not gotten a
@@ -167,10 +174,12 @@ void ReliableMessageMgr::ExecuteActions()
167
174
}
168
175
169
176
entry->sendCount ++;
177
+
170
178
ChipLogProgress (ExchangeManager,
171
- " Retransmitting MessageCounter:" ChipLogFormatMessageCounter " on exchange " ChipLogFormatExchange
172
- " Send Cnt %d" ,
173
- messageCounter, ChipLogValueExchange (&entry->ec .Get ()), entry->sendCount );
179
+ " <<%d [E:" ChipLogFormatExchange " S:%u M:" ChipLogFormatMessageCounter
180
+ " ] (%s) Msg Retransmission to %u:" ChipLogFormatX64,
181
+ entry->sendCount , ChipLogValueExchange (&entry->ec .Get ()), session->SessionIdForLogging (), messageCounter,
182
+ Transport::GetSessionTypeString (session), fabricIndex, ChipLogValueX64 (destination));
174
183
MATTER_LOG_METRIC (Tracing::kMetricDeviceRMPRetryCount , entry->sendCount );
175
184
176
185
CalculateNextRetransTime (*entry);
@@ -467,22 +476,50 @@ void ReliableMessageMgr::SetAdditionalMRPBackoffTime(const Optional<System::Cloc
467
476
void ReliableMessageMgr::CalculateNextRetransTime (RetransTableEntry & entry)
468
477
{
469
478
System::Clock::Timeout baseTimeout = System::Clock::Timeout (0 );
479
+ const auto sessionHandle = entry.ec ->GetSessionHandle ();
470
480
471
481
// Check if we have received at least one application-level message
472
482
if (entry.ec ->HasReceivedAtLeastOneMessage ())
473
483
{
474
484
// If we have received at least one message, assume peer is active and use ActiveRetransTimeout
475
- baseTimeout = entry. ec -> GetSessionHandle () ->GetRemoteMRPConfig ().mActiveRetransTimeout ;
485
+ baseTimeout = sessionHandle ->GetRemoteMRPConfig ().mActiveRetransTimeout ;
476
486
}
477
487
else
478
488
{
479
489
// If we haven't received at least one message
480
490
// Choose active/idle timeout from PeerActiveMode of session per 4.11.2.1. Retransmissions.
481
- baseTimeout = entry. ec -> GetSessionHandle () ->GetMRPBaseTimeout ();
491
+ baseTimeout = sessionHandle ->GetMRPBaseTimeout ();
482
492
}
483
493
484
494
System::Clock::Timeout backoff = ReliableMessageMgr::GetBackoff (baseTimeout, entry.sendCount );
485
495
entry.nextRetransTime = System::SystemClock ().GetMonotonicTimestamp () + backoff;
496
+
497
+ #if CHIP_PROGRESS_LOGGING
498
+ const auto config = sessionHandle->GetRemoteMRPConfig ();
499
+ uint32_t messageCounter = entry.retainedBuf .GetMessageCounter ();
500
+ auto fabricIndex = sessionHandle->GetFabricIndex ();
501
+ auto destination = kUndefinedNodeId ;
502
+ bool peerIsActive = false ;
503
+
504
+ if (sessionHandle->IsSecureSession ())
505
+ {
506
+ peerIsActive = sessionHandle->AsSecureSession ()->IsPeerActive ();
507
+ destination = sessionHandle->AsSecureSession ()->GetPeerNodeId ();
508
+ }
509
+ else if (sessionHandle->IsUnauthenticatedSession ())
510
+ {
511
+ peerIsActive = sessionHandle->AsUnauthenticatedSession ()->IsPeerActive ();
512
+ }
513
+
514
+ ChipLogProgress (ExchangeManager,
515
+ " ??%d [E:" ChipLogFormatExchange " S:%u M:" ChipLogFormatMessageCounter
516
+ " ] (%s) Msg Retransmission to %u:" ChipLogFormatX64 " in %" PRIu16 " ms [State:%s II:%" PRIu32 " AI:%" PRIu32
517
+ " AT:%" PRIu16 " ]" ,
518
+ entry.sendCount + 1 , ChipLogValueExchange (&entry.ec .Get ()), sessionHandle->SessionIdForLogging (),
519
+ messageCounter, Transport::GetSessionTypeString (sessionHandle), fabricIndex, ChipLogValueX64 (destination),
520
+ backoff.count (), peerIsActive ? " Active" : " Idle" , config.mIdleRetransTimeout .count (),
521
+ config.mActiveRetransTimeout .count (), config.mActiveThresholdTime .count ());
522
+ #endif // CHIP_PROGRESS_LOGGING
486
523
}
487
524
488
525
#if CHIP_CONFIG_TEST
0 commit comments