From f5c55c5e23a1a8c199ac8c86c79a0e876a13a809 Mon Sep 17 00:00:00 2001 From: Abtin Keshavarzian Date: Sat, 15 Sep 2018 14:42:33 -0700 Subject: [PATCH] [poisx-app] fix delayed TxDone callback (#3074) --- src/posix/platform/radio_spinel.cpp | 30 ++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/posix/platform/radio_spinel.cpp b/src/posix/platform/radio_spinel.cpp index 38faa18d2..16ab95e7b 100644 --- a/src/posix/platform/radio_spinel.cpp +++ b/src/posix/platform/radio_spinel.cpp @@ -794,7 +794,7 @@ void RadioSpinel::UpdateFdSet(fd_set &aReadFdSet, fd_set &aWriteFdSet, int &aMax } } - if (!mFrameQueue.IsEmpty()) + if (!mFrameQueue.IsEmpty() || (mState == OT_RADIO_STATE_TRANSMIT && mTxState == kDone)) { aTimeout.tv_sec = 0; aTimeout.tv_usec = 0; @@ -813,24 +813,24 @@ void RadioSpinel::Process(const fd_set &aReadFdSet, const fd_set &aWriteFdSet) ReadAll(); ProcessFrameQueue(); } + } - if (mState == OT_RADIO_STATE_TRANSMIT && mTxState == kDone) - { - mState = OT_RADIO_STATE_RECEIVE; + if (mState == OT_RADIO_STATE_TRANSMIT && mTxState == kDone) + { + mState = OT_RADIO_STATE_RECEIVE; #if OPENTHREAD_ENABLE_DIAG - if (otPlatDiagModeGet()) - { - otPlatDiagRadioTransmitDone(mInstance, mTransmitFrame, mTxError); - } - else -#endif - { - otPlatRadioTxDone(mInstance, mTransmitFrame, (mIsAckRequested ? &mRxRadioFrame : NULL), mTxError); - } - - mTxState = kIdle; + if (otPlatDiagModeGet()) + { + otPlatDiagRadioTransmitDone(mInstance, mTransmitFrame, mTxError); } + else +#endif + { + otPlatRadioTxDone(mInstance, mTransmitFrame, (mIsAckRequested ? &mRxRadioFrame : NULL), mTxError); + } + + mTxState = kIdle; } if (FD_ISSET(mSockFd, &aWriteFdSet))