net/tcp: fix potential busy loop in tcp_send_buffered.c
if the wrbuffer does not have enough space to send the rest of the data, then the send function will loop infinitely in nonblock mode, add send timeout check to avoid this issue. Signed-off-by: chao an <anchao@xiaomi.com>
This commit is contained in:
parent
1b333bfad5
commit
715785245c
|
@ -1361,7 +1361,8 @@ ssize_t psock_tcp_send(FAR struct socket *psock, FAR const void *buf,
|
|||
tcp_wrbuffer_release(wrb);
|
||||
}
|
||||
|
||||
if (nonblock)
|
||||
if (nonblock || (timeout != UINT_MAX &&
|
||||
tcp_send_gettimeout(start, timeout) == 0))
|
||||
{
|
||||
nerr("ERROR: Failed to add data to the I/O chain\n");
|
||||
ret = -EAGAIN;
|
||||
|
|
Loading…
Reference in New Issue