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

acassis 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 753aa98ca7 net/tcp: Zero keeptimer in case caller set keepalive to 
false
753aa98ca7 is described below

commit 753aa98ca712c5ef83685363060307c172c04b94
Author: Xiang Xiao <[email protected]>
AuthorDate: Thu May 19 01:59:12 2022 +0800

    net/tcp: Zero keeptimer in case caller set keepalive to false
    
    Signed-off-by: Xiang Xiao <[email protected]>
---
 net/tcp/tcp_setsockopt.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/net/tcp/tcp_setsockopt.c b/net/tcp/tcp_setsockopt.c
index 402b0e3e94..600a14aeaa 100644
--- a/net/tcp/tcp_setsockopt.c
+++ b/net/tcp/tcp_setsockopt.c
@@ -129,11 +129,8 @@ int tcp_setsockopt(FAR struct socket *psock, int option,
 
                 /* Reset timer */
 
-                if (conn->keepalive)
-                  {
-                    conn->keeptimer   = conn->keepidle;
-                    conn->keepretries = 0;
-                  }
+                conn->keeptimer   = keepalive ? conn->keepidle : 0;
+                conn->keepretries = 0;
               }
           }
         break;

Reply via email to