From bf48a647b382083a9d09e1a5b897ad55cffffd30 Mon Sep 17 00:00:00 2001 From: Abtin Keshavarzian Date: Wed, 9 Jan 2019 09:43:51 -0800 Subject: [PATCH] [mac] stop timer on pending WaitingForData operation on rx-on-idle change (#3437) This commit changes `SetRxOnWhenIdle()` to stop the timer (data poll timeout) if there is a pending `kOperationWaitingForData` when rx-on- when-idle is being enabled. This addresses an issue where the timer could remain active if the `SetRxOnwhenIdle(true)` is called before the operation `kOperationWaitingForData` actually starts. Note that the data poll timeout timer gets started while current operation is `kOperationTransmitData` (from `HandleTransmitDone()` on a successful data request frame transmission with a received ack indicating a pending frame). --- src/core/mac/mac.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/core/mac/mac.cpp b/src/core/mac/mac.cpp index c21914ff2..452a84053 100644 --- a/src/core/mac/mac.cpp +++ b/src/core/mac/mac.cpp @@ -323,7 +323,11 @@ void Mac::SetRxOnWhenIdle(bool aRxOnWhenIdle) if (mRxOnWhenIdle) { - mPendingWaitingForData = false; + if (mPendingWaitingForData) + { + mTimer.Stop(); + mPendingWaitingForData = false; + } if (mOperation == kOperationWaitingForData) {