This is an automated email from the ASF dual-hosted git repository.

xiaoxiang781216 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 2dbadd67fb2dcc0dfc9642eb384872382afb673b
Author: raiden00pl <[email protected]>
AuthorDate: Tue Nov 17 20:38:26 2026 +0100

    net/tcp: wait for IOBs in an unbuffered send().
    
    devif_send() fails with -ENOMEM while the IOB pool is empty, and send()
    returns the error to the application.  Retry on the next poll or
    retransmission instead.
    
    Assisted-by: Claude Code:claude-opus-5-5
    Signed-off-by: raiden00pl <[email protected]>
---
 net/tcp/tcp_send_unbuffered.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/net/tcp/tcp_send_unbuffered.c b/net/tcp/tcp_send_unbuffered.c
index 66dd05ccb73..ebd74565acf 100644
--- a/net/tcp/tcp_send_unbuffered.c
+++ b/net/tcp/tcp_send_unbuffered.c
@@ -290,7 +290,13 @@ static uint32_t tcpsend_eventhandler(FAR struct 
net_driver_s *dev,
 
       ret = devif_send(dev, &pstate->snd_buffer[pstate->snd_acked],
                        sndlen, tcpip_hdrsize(conn));
-      if (ret <= 0)
+      if (ret == -ENOMEM)
+        {
+          /* Out of IOBs: retry on the next timeout */
+
+          return flags;
+        }
+      else if (ret <= 0)
         {
           pstate->snd_sent = ret;
           goto end_wait;
@@ -377,7 +383,13 @@ static uint32_t tcpsend_eventhandler(FAR struct 
net_driver_s *dev,
 
           ret = devif_send(dev, &pstate->snd_buffer[pstate->snd_sent],
                            sndlen, tcpip_hdrsize(conn));
-          if (ret <= 0)
+          if (ret == -ENOMEM)
+            {
+              /* Out of IOBs: retry on the next poll */
+
+              return flags;
+            }
+          else if (ret <= 0)
             {
               pstate->snd_sent = ret;
               goto end_wait;

Reply via email to