net/tcp: Initialize the sndseq_max.

Initialize conn->sndseq_max when tcp conn alloc

Signed-off-by: liqinhui <liqinhui@xiaomi.com>
This commit is contained in:
liqinhui
2025-01-06 22:51:35 +08:00
committed by Xiang Xiao
parent a91c50243e
commit facb9d4e65
+8 -7
View File
@@ -1153,7 +1153,7 @@ FAR struct tcp_conn_s *tcp_alloc_accept(FAR struct net_driver_s *dev,
conn->expired = 0;
conn->isn = 0;
conn->sent = 0;
conn->sndseq_max = 0;
conn->sndseq_max = tcp_getsequence(conn->sndseq);
#endif
#ifdef CONFIG_NET_TCP_CC_NEWRENO
@@ -1456,17 +1456,18 @@ int tcp_connect(FAR struct tcp_conn_s *conn, FAR const struct sockaddr *addr)
conn->sa = 0;
conn->sv = 16; /* Initial value of the RTT variance. */
conn->lport = (uint16_t)port;
#ifdef CONFIG_NET_TCP_WRITE_BUFFERS
conn->expired = 0;
conn->isn = 0;
conn->sent = 0;
conn->sndseq_max = 0;
#endif
/* Set initial sndseq when we have both local/remote addr and port */
tcp_initsequence(conn);
#ifdef CONFIG_NET_TCP_WRITE_BUFFERS
conn->expired = 0;
conn->isn = 0;
conn->sent = 0;
conn->sndseq_max = tcp_getsequence(conn->sndseq);
#endif
/* Save initial sndseq to rexmit_seq, otherwise it will be zero */
#if !defined(CONFIG_NET_TCP_WRITE_BUFFERS)