mirror of
https://github.com/espressif/openthread.git
synced 2026-08-19 00:49:53 +00:00
[ncp-uart] fix the bug in uart encoder (#2145)
This commit fixes an issue with the `NcpUart::EncodeAndSendToUart()` code where the last message can be removed from `mTxFrameBuffer` and if we ran out of buffer and cannot finalize the HDLC encoded frame, the final bytes would not be sent until next message is queued in `mTxBuffer`.
This commit is contained in:
committed by
Jonathan Hui
parent
34753d02ea
commit
36f4f43adc
@@ -137,7 +137,7 @@ void NcpUart::EncodeAndSendToUart(void)
|
||||
{
|
||||
uint16_t len;
|
||||
|
||||
while (!mTxFrameBuffer.IsEmpty())
|
||||
while (!mTxFrameBuffer.IsEmpty() || (mState == kFinalizingFrame))
|
||||
{
|
||||
switch (mState)
|
||||
{
|
||||
@@ -159,7 +159,7 @@ void NcpUart::EncodeAndSendToUart(void)
|
||||
{
|
||||
mByte = mTxFrameBuffer.OutFrameReadByte();
|
||||
|
||||
case kEncodingFrame:
|
||||
case kEncodingFrame:
|
||||
|
||||
SuccessOrExit(mFrameEncoder.Encode(mByte, mUartBuffer));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user