You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by ma...@apache.org on 2020/12/10 03:25:53 UTC
[incubator-nuttx] 02/03: net/tcp: add a member to record the
current receiving window
This is an automated email from the ASF dual-hosted git repository.
masayuki pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
commit 881dd9d62d034ce23268e31691aa59c478fada43
Author: chao.an <an...@xiaomi.com>
AuthorDate: Mon Dec 7 14:12:59 2020 +0800
net/tcp: add a member to record the current receiving window
Change-Id: Ic4c46d643a905fdd3a828e563eab4814da70dbe5
Signed-off-by: chao.an <an...@xiaomi.com>
---
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 b0b0277..29ca5dc 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 fc67f45..a3649b8 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 ee82f00..190d4e6 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 */