summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/netinet/tcp_output.c9
-rw-r--r--sys/netinet/tcp_var.h1
2 files changed, 9 insertions, 1 deletions
diff --git a/sys/netinet/tcp_output.c b/sys/netinet/tcp_output.c
index 2740c726860e..e473b8e3a279 100644
--- a/sys/netinet/tcp_output.c
+++ b/sys/netinet/tcp_output.c
@@ -135,7 +135,7 @@ tcp_output(tp)
* If there is some data or critical controls (SYN, RST)
* to send, then transmit; otherwise, investigate further.
*/
- idle = (tp->snd_max == tp->snd_una);
+ idle = (tp->t_flags & TF_LASTIDLE) || (tp->snd_max == tp->snd_una);
if (idle && (ticks - tp->t_rcvtime) >= tp->t_rxtcur) {
/*
* We have been idle for "a while" and no acks are
@@ -159,6 +159,13 @@ tcp_output(tp)
else
tp->snd_cwnd = tp->t_maxseg * ss_fltsz;
}
+ tp->t_flags &= ~TF_LASTIDLE;
+ if (idle) {
+ if (tp->t_flags & TF_MORETOCOME) {
+ tp->t_flags |= TF_LASTIDLE;
+ idle = 0;
+ }
+ }
again:
sendalot = 0;
off = tp->snd_nxt - tp->snd_una;
diff --git a/sys/netinet/tcp_var.h b/sys/netinet/tcp_var.h
index 9c2803fe1490..7dc1bacd3dff 100644
--- a/sys/netinet/tcp_var.h
+++ b/sys/netinet/tcp_var.h
@@ -95,6 +95,7 @@ struct tcpcb {
#define TF_SENDCCNEW 0x08000 /* send CCnew instead of CC in SYN */
#define TF_MORETOCOME 0x10000 /* More data to be appended to sock */
#define TF_LQ_OVERFLOW 0x20000 /* listen queue overflow */
+#define TF_LASTIDLE 0x40000 /* connection was previously idle */
int t_force; /* 1 if forcing out a byte */
tcp_seq snd_una; /* send unacknowledged */