From 881dd9d62d034ce23268e31691aa59c478fada43 Mon Sep 17 00:00:00 2001 From: "chao.an" Date: Mon, 7 Dec 2020 14:12:59 +0800 Subject: [PATCH] net/tcp: add a member to record the current receiving window Change-Id: Ic4c46d643a905fdd3a828e563eab4814da70dbe5 Signed-off-by: chao.an --- net/sixlowpan/sixlowpan_tcpsend.c | 4 ++++ net/tcp/tcp.h | 1 + net/tcp/tcp_send.c | 4 ++++ 3 files changed, 9 insertions(+) diff --git a/net/sixlowpan/sixlowpan_tcpsend.c b/net/sixlowpan/sixlowpan_tcpsend.c index b0b0277f8b..29ca5dc5c8 100644 --- a/net/sixlowpan/sixlowpan_tcpsend.c +++ b/net/sixlowpan/sixlowpan_tcpsend.c @@ -263,6 +263,10 @@ static int sixlowpan_tcp_header(FAR struct tcp_conn_s *conn, ipv6tcp->tcp.wnd[0] = recvwndo >> 8; ipv6tcp->tcp.wnd[1] = recvwndo & 0xff; + + /* Update the Receiver Window */ + + conn->rcv_wnd = recvwndo; } /* Calculate TCP checksum. */ diff --git a/net/tcp/tcp.h b/net/tcp/tcp.h index fc67f45f21..a3649b88ec 100644 --- a/net/tcp/tcp.h +++ b/net/tcp/tcp.h @@ -194,6 +194,7 @@ struct tcp_conn_s * connection */ uint16_t snd_wnd; /* Sequence and acknowledgement numbers of last * window update */ + uint16_t rcv_wnd; /* Receiver window available */ #ifdef CONFIG_NET_TCP_WRITE_BUFFERS uint32_t tx_unacked; /* Number bytes sent but not yet ACKed */ #else diff --git a/net/tcp/tcp_send.c b/net/tcp/tcp_send.c index ee82f00383..190d4e6ee9 100644 --- a/net/tcp/tcp_send.c +++ b/net/tcp/tcp_send.c @@ -366,6 +366,10 @@ static void tcp_sendcommon(FAR struct net_driver_s *dev, tcp->wnd[0] = recvwndo >> 8; tcp->wnd[1] = recvwndo & 0xff; + + /* Update the Receiver Window */ + + conn->rcv_wnd = recvwndo; } /* Finish the IP portion of the message and calculate checksums */