mirror of
https://github.com/apache/nuttx.git
synced 2025-01-12 22:08:35 +08:00
net/udp: Let cansend return EWOULDBLOCK when send buffer is full
Notes: 1. This commit do the same thing as TCP did: https://github.com/apache/nuttx/pull/10627 2. UDP uses `iob_navail(false)` but TCP uses `iob_navail(true)`, this is because of a problem related to TCP recv window (https://github.com/apache/nuttx/pull/4142), so we don't need to change UDP now. Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
This commit is contained in:
parent
6fb12b0284
commit
3b26c6df51
1 changed files with 5 additions and 1 deletions
|
@ -941,7 +941,11 @@ int psock_udp_cansend(FAR struct udp_conn_s *conn)
|
|||
* many more.
|
||||
*/
|
||||
|
||||
if (udp_wrbuffer_test() < 0 || iob_navail(false) <= 0)
|
||||
if (udp_wrbuffer_test() < 0 || iob_navail(false) <= 0
|
||||
#if CONFIG_NET_SEND_BUFSIZE > 0
|
||||
|| udp_wrbuffer_inqueue_size(conn) >= conn->sndbufs
|
||||
#endif
|
||||
)
|
||||
{
|
||||
return -EWOULDBLOCK;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue