You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by "pkarashchenko (via GitHub)" <gi...@apache.org> on 2023/03/10 08:45:53 UTC

[GitHub] [nuttx] pkarashchenko commented on a diff in pull request #8782: tcp: add TCP_MAXSEG support

pkarashchenko commented on code in PR #8782:
URL: https://github.com/apache/nuttx/pull/8782#discussion_r1132095786


##########
net/tcp/tcp_conn.c:
##########
@@ -1086,27 +1087,48 @@ FAR struct tcp_conn_s *tcp_alloc_accept(FAR struct net_driver_s *dev,
           return NULL;
         }
 
+      /* Inherits the necessary fields from listener conn for
+       * the new connection.
+       */
+
+#ifdef CONFIG_NET_SOCKOPTS
+      conn->sconn.s_rcvtimeo = listener->sconn.s_rcvtimeo;
+      conn->sconn.s_sndtimeo = listener->sconn.s_sndtimeo;
+#  ifdef CONFIG_NET_BINDTODEVICE
+      conn->sconn.s_boundto  = listener->sconn.s_boundto;
+#  endif
+#endif
+
+      conn->sconn.s_tos      = listener->sconn.s_tos;
+#if CONFIG_NET_RECV_BUFSIZE > 0
+      conn->rcv_bufs         = listener->rcv_bufs;
+#endif
+#if CONFIG_NET_SEND_BUFSIZE > 0
+      conn->snd_bufs         = listener->snd_bufs;
+#endif
+      conn->mss              = listener->mss;
+
       /* Fill in the necessary fields for the new connection. */
 
-      conn->rto           = TCP_RTO;
-      conn->sa            = 0;
-      conn->sv            = 4;
-      conn->nrtx          = 0;
-      conn->lport         = tcp->destport;
-      conn->rport         = tcp->srcport;
-      conn->tcpstateflags = TCP_SYN_RCVD;
+      conn->rto              = TCP_RTO;
+      conn->sa               = 0;
+      conn->sv               = 4;
+      conn->nrtx             = 0;
+      conn->lport            = tcp->destport;
+      conn->rport            = tcp->srcport;
+      conn->tcpstateflags    = TCP_SYN_RCVD;
 
       tcp_initsequence(conn->sndseq);
 #if !defined(CONFIG_NET_TCP_WRITE_BUFFERS)
       conn->rexmit_seq = tcp_getsequence(conn->sndseq);
 #endif
 
-      conn->tx_unacked    = 1;
+      conn->tx_unacked       = 1;

Review Comment:
   Maybe `conn->rexmit_seq = tcp_getsequence(conn->sndseq);` should also be adjusted?



-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org