Skip to content

Commit

Permalink
net/udp: Let cansend return EWOULDBLOCK when send buffer is full
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
wengzhe authored and xiaoxiang781216 committed Jan 2, 2025
1 parent 6fb12b0 commit 3b26c6d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion net/udp/udp_sendto_buffered.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 3b26c6d

Please sign in to comment.