net/tcp: syscall send() should not return ETIMEDOUT

Signed-off-by: chao an <anchao@xiaomi.com>
This commit is contained in:
chao.an 2022-06-27 13:15:13 +08:00 committed by Masayuki Ishikawa
parent 969a06331f
commit 76c64b7d30

View File

@ -1232,6 +1232,11 @@ ssize_t psock_tcp_send(FAR struct socket *psock, FAR const void *buf,
tcp_send_gettimeout(start, timeout));
if (ret < 0)
{
if (ret == -ETIMEDOUT)
{
ret = -EAGAIN;
}
goto errout_with_lock;
}
}
@ -1285,14 +1290,10 @@ ssize_t psock_tcp_send(FAR struct socket *psock, FAR const void *buf,
nerr("ERROR: Failed to allocate write buffer\n");
if (nonblock)
if (nonblock || timeout != UINT_MAX)
{
ret = -EAGAIN;
}
else if (timeout != UINT_MAX)
{
ret = -ETIMEDOUT;
}
else
{
ret = -ENOMEM;