[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:
Abtin Keshavarzian
2017-08-28 21:16:38 -07:00
committed by Jonathan Hui
parent 34753d02ea
commit 36f4f43adc
+2 -2
View File
@@ -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));
}