You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by ma...@apache.org on 2022/10/15 01:17:30 UTC

[incubator-nuttx] branch master updated: net/tcp: syscall send() should not return ETIMEDOUT

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 76c64b7d30 net/tcp: syscall send() should not return ETIMEDOUT
76c64b7d30 is described below

commit 76c64b7d30453d9320c788cf4fe097646c2ba56f
Author: chao.an <an...@xiaomi.com>
AuthorDate: Mon Jun 27 13:15:13 2022 +0800

    net/tcp: syscall send() should not return ETIMEDOUT
    
    Signed-off-by: chao an <an...@xiaomi.com>
---
 net/tcp/tcp_send_buffered.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/net/tcp/tcp_send_buffered.c b/net/tcp/tcp_send_buffered.c
index 7086a6fab7..de96e60474 100644
--- a/net/tcp/tcp_send_buffered.c
+++ b/net/tcp/tcp_send_buffered.c
@@ -1232,6 +1232,11 @@ ssize_t psock_tcp_send(FAR struct socket *psock, FAR const void *buf,
             tcp_send_gettimeout(start, timeout));
           if (ret < 0)
             {
+              if (ret == -ETIMEDOUT)
+                {
+                  ret = -EAGAIN;
+                }
+
               goto errout_with_lock;
             }
         }
@@ -1285,14 +1290,10 @@ ssize_t psock_tcp_send(FAR struct socket *psock, FAR const void *buf,
 
               nerr("ERROR: Failed to allocate write buffer\n");
 
-              if (nonblock)
+              if (nonblock || timeout != UINT_MAX)
                 {
                   ret = -EAGAIN;
                 }
-              else if (timeout != UINT_MAX)
-                {
-                  ret = -ETIMEDOUT;
-                }
               else
                 {
                   ret = -ENOMEM;