Skip to content

Commit

Permalink
[mrp] Increase MRP backoff time for SED sender
Browse files Browse the repository at this point in the history
When sender is sleepy, it may take more time until it
receives an acknowledgment from a peer, so MRP backoff time
should be extended by the sleepy active interval.

Signed-off-by: Damian Krolik <[email protected]>
  • Loading branch information
Damian-Nordic committed Jul 28, 2022
1 parent 1758f54 commit 035fc25
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/messaging/ReliableMessageMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#include <messaging/ExchangeMgr.h>
#include <messaging/Flags.h>
#include <messaging/ReliableMessageContext.h>
#include <platform/ConnectivityManager.h>

using namespace chip::System::Clock::Literals;

Expand Down Expand Up @@ -248,6 +249,18 @@ System::Clock::Timestamp ReliableMessageMgr::GetBackoff(System::Clock::Timestamp
uint32_t jitter = MRP_BACKOFF_JITTER_BASE + Crypto::GetRandU8();
mrpBackoffTime = mrpBackoffTime * jitter / MRP_BACKOFF_JITTER_BASE;

#if CHIP_DEVICE_CONFIG_ENABLE_SED
// Implement:
// "A sleepy sender SHOULD increase t to also account for its own sleepy interval
// required to receive the acknowledgment"
DeviceLayer::ConnectivityManager::SEDIntervalsConfig sedIntervals;

if (DeviceLayer::ConnectivityMgr().GetSEDIntervalsConfig(sedIntervals) == CHIP_NO_ERROR)
{
mrpBackoffTime += System::Clock::Timestamp(sedIntervals.ActiveIntervalMS);
}
#endif

return mrpBackoffTime;
}

Expand Down

0 comments on commit 035fc25

Please sign in to comment.