From 6bd04ddcda30d5341b5b7596fb79a4c4a1e3d9c9 Mon Sep 17 00:00:00 2001 From: Jonathan Hui Date: Mon, 2 Jul 2018 10:44:50 -0500 Subject: [PATCH] [mesh-forwarder] retransmit on CCA errors (#2846) This commit changes the way the mesh forwarder layer handles transmit attempt failures due to CCA failures. Prior to this commit, the mesh forwarder layer would simply drop the packet. This commit keeps the packet in the queue so that it can be retransmitted at a later time. This applies to both direct and indirect transmissions. --- src/core/thread/mesh_forwarder.cpp | 7 +------ src/core/thread/mesh_forwarder_ftd.cpp | 2 ++ 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/core/thread/mesh_forwarder.cpp b/src/core/thread/mesh_forwarder.cpp index dea115d3a..6f5950057 100644 --- a/src/core/thread/mesh_forwarder.cpp +++ b/src/core/thread/mesh_forwarder.cpp @@ -951,11 +951,6 @@ void MeshForwarder::HandleSentFrame(Mac::Frame &aFrame, otError aError) VerifyOrExit(mEnabled); - if (mSendMessage != NULL) - { - mSendMessage->SetOffset(mMessageNextOffset); - } - aFrame.GetDstAddr(macDest); if ((neighbor = netif.GetMle().GetNeighbor(macDest)) != NULL) @@ -995,7 +990,7 @@ void MeshForwarder::HandleSentFrame(Mac::Frame &aFrame, otError aError) HandleSentFrameToChild(aFrame, aError, macDest); - VerifyOrExit(mSendMessage != NULL); + VerifyOrExit((mSendMessage != NULL) && ((aError == OT_ERROR_NONE) || (aError == OT_ERROR_NO_ACK))); if (mSendMessage->GetDirectTransmission()) { diff --git a/src/core/thread/mesh_forwarder_ftd.cpp b/src/core/thread/mesh_forwarder_ftd.cpp index 48bafccf8..497fdfe02 100644 --- a/src/core/thread/mesh_forwarder_ftd.cpp +++ b/src/core/thread/mesh_forwarder_ftd.cpp @@ -649,6 +649,8 @@ void MeshForwarder::HandleSentFrameToChild(const Mac::Frame &aFrame, otError aEr } } + VerifyOrExit((aError == OT_ERROR_NONE) || (aError == OT_ERROR_NO_ACK)); + if (mMessageNextOffset < mSendMessage->GetLength()) { if (mSendMessage == child->GetIndirectMessage())