casaroli commented on code in PR #22441:
URL: https://github.com/apache/nuttx/pull/22441#discussion_r4716243666


##########
net/tcp/tcp.h:
##########
@@ -272,6 +272,8 @@ struct tcp_conn_s
                            * variable */
   uint8_t  rto;           /* Retransmission time-out */
   uint8_t  tcpstateflags; /* TCP state and flags */
+  bool     cork;          /* TCP_CORK was set (a hint: segments are not

Review Comment:
   The bit of s_options is set only by SOL_SOCKET options 
(net/socket/setsockopt.c). TCP-level state, like keepalive, stays in struct 
tcp_conn_s (tcp.h:402).
   



##########
net/tcp/tcp_setsockopt.c:
##########
@@ -216,22 +216,30 @@ int tcp_setsockopt(FAR struct socket *psock, int option,
 #endif /* CONFIG_NET_TCP_KEEPALIVE */
 
       case TCP_NODELAY: /* Avoid coalescing of small segments. */
-      case TCP_CORK:    /* coalescing of small segments. */
         if (value_len != sizeof(int))
           {
             ret = -EDOM;
           }
-        else
+        else if (*(FAR int *)value == 0)
           {
-            int nodelay = *(FAR int *)value;
+            nerr("ERROR: TCP_NODELAY 0 not supported\n");
+            ret = -ENOSYS;
+          }
+        break;
 
-            if ((!nodelay && option == TCP_NODELAY) ||
-                (nodelay && option == TCP_CORK))
-              {
-                nerr("ERROR: %s not supported\n",
-                     option == TCP_NODELAY ? "TCP_NODELAY" : "TCP_CORK");
-                ret = -ENOSYS;
-              }
+      case TCP_CORK:    /* Coalescing of small segments. */

Review Comment:
   It is already supported: tcp_getsockopt.c:223 returns conn->cork for 
TCP_CORK.
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to