Skip to content

Commit 3b26c6d

Browse files
wengzhexiaoxiang781216
authored andcommitted
net/udp: Let cansend return EWOULDBLOCK when send buffer is full
Notes: 1. This commit do the same thing as TCP did: apache#10627 2. UDP uses `iob_navail(false)` but TCP uses `iob_navail(true)`, this is because of a problem related to TCP recv window (apache#4142), so we don't need to change UDP now. Signed-off-by: Zhe Weng <[email protected]>
1 parent 6fb12b0 commit 3b26c6d

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

net/udp/udp_sendto_buffered.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -941,7 +941,11 @@ int psock_udp_cansend(FAR struct udp_conn_s *conn)
941941
* many more.
942942
*/
943943

944-
if (udp_wrbuffer_test() < 0 || iob_navail(false) <= 0)
944+
if (udp_wrbuffer_test() < 0 || iob_navail(false) <= 0
945+
#if CONFIG_NET_SEND_BUFSIZE > 0
946+
|| udp_wrbuffer_inqueue_size(conn) >= conn->sndbufs
947+
#endif
948+
)
945949
{
946950
return -EWOULDBLOCK;
947951
}

0 commit comments

Comments
 (0)