Skip to content

Commit

Permalink
with helper method
Browse files Browse the repository at this point in the history
  • Loading branch information
edmont committed Sep 5, 2023
1 parent 454e69e commit 3aec869
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/core/mac/data_poll_handler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ void DataPollHandler::RequestFrameChange(FrameChange aChange, Child &aChild)
}
else
{
ResetTxAttempts(aChild);
mCallbacks.HandleFrameChangeDone(aChild);
}
}
Expand Down Expand Up @@ -240,17 +241,15 @@ void DataPollHandler::HandleSentFrame(const Mac::TxFrame &aFrame, Error aError,
{
aChild.SetFramePurgePending(false);
aChild.SetFrameReplacePending(false);
ResetTxAttempts(aChild);
mCallbacks.HandleFrameChangeDone(aChild);
ExitNow();
}

switch (aError)
{
case kErrorNone:
aChild.ResetIndirectTxAttempts();
#if OPENTHREAD_CONFIG_MAC_CSL_TRANSMITTER_ENABLE
aChild.ResetCslTxAttempts();
#endif
ResetTxAttempts(aChild);
aChild.SetFrameReplacePending(false);
break;

Expand All @@ -269,6 +268,7 @@ void DataPollHandler::HandleSentFrame(const Mac::TxFrame &aFrame, Error aError,
if (aChild.IsFrameReplacePending())
{
aChild.SetFrameReplacePending(false);
ResetTxAttempts(aChild);
mCallbacks.HandleFrameChangeDone(aChild);
ExitNow();
}
Expand Down Expand Up @@ -333,6 +333,15 @@ void DataPollHandler::ProcessPendingPolls(void)
}
}

void DataPollHandler::ResetTxAttempts(Child &aChild)
{
aChild.ResetIndirectTxAttempts();

#if OPENTHREAD_CONFIG_MAC_CSL_TRANSMITTER_ENABLE
aChild.ResetCslTxAttempts();
#endif
}

} // namespace ot

#endif // #if OPENTHREAD_FTD
1 change: 1 addition & 0 deletions src/core/mac/data_poll_handler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,7 @@ class DataPollHandler : public InstanceLocator, private NonCopyable

void HandleSentFrame(const Mac::TxFrame &aFrame, Error aError, Child &aChild);
void ProcessPendingPolls(void);
void ResetTxAttempts(Child &aChild);

// In the current implementation of `DataPollHandler`, we can have a
// single indirect tx operation active at MAC layer at each point of
Expand Down

0 comments on commit 3aec869

Please sign in to comment.