mirror of
https://github.com/espressif/openthread.git
synced 2026-08-04 18:07:47 +00:00
[posix] wait for writable before next try (#5143)
This commit waits fd to be writable before try writing next time.
This commit is contained in:
@@ -235,16 +235,18 @@ otError HdlcInterface::Write(const uint8_t *aFrame, uint16_t aLength)
|
||||
{
|
||||
ssize_t rval = write(mSockFd, aFrame, aLength);
|
||||
|
||||
if (rval > 0)
|
||||
if (rval == aLength)
|
||||
{
|
||||
break;
|
||||
}
|
||||
else if (rval > 0)
|
||||
{
|
||||
aLength -= static_cast<uint16_t>(rval);
|
||||
aFrame += static_cast<uint16_t>(rval);
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((rval < 0) && (errno != EAGAIN) && (errno != EWOULDBLOCK) && (errno != EINTR))
|
||||
else if (rval < 0)
|
||||
{
|
||||
DieNow(OT_EXIT_ERROR_ERRNO);
|
||||
VerifyOrDie((errno == EAGAIN) || (errno == EWOULDBLOCK) || (errno == EINTR), OT_EXIT_ERROR_ERRNO);
|
||||
}
|
||||
|
||||
SuccessOrExit(error = WaitForWritable());
|
||||
|
||||
Reference in New Issue
Block a user