summaryrefslogtreecommitdiffstats
path: root/sys/netinet/tcp_timer.c
diff options
context:
space:
mode:
authordg <dg@FreeBSD.org>1995-07-29 18:48:44 +0000
committerdg <dg@FreeBSD.org>1995-07-29 18:48:44 +0000
commit03d42e175c7226e547963c027ae9cd0dc0a518ea (patch)
treef0e3e8247b87e2cfe3801469917d01acb4b4dbcc /sys/netinet/tcp_timer.c
parentcd6ef599be54727e4f352b8d862c7a4dc4186b90 (diff)
downloadFreeBSD-src-03d42e175c7226e547963c027ae9cd0dc0a518ea.zip
FreeBSD-src-03d42e175c7226e547963c027ae9cd0dc0a518ea.tar.gz
Add connection drop capability for persist timeouts.
Reviewed by: Andras Olah Obtained from: 4.4BSD-lite2 via W. Richard Stevens
Diffstat (limited to 'sys/netinet/tcp_timer.c')
-rw-r--r--sys/netinet/tcp_timer.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/sys/netinet/tcp_timer.c b/sys/netinet/tcp_timer.c
index ddab8d6..9badee0 100644
--- a/sys/netinet/tcp_timer.c
+++ b/sys/netinet/tcp_timer.c
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)tcp_timer.c 8.1 (Berkeley) 6/10/93
- * $Id: tcp_timer.c,v 1.6 1995/04/12 06:49:56 davidg Exp $
+ * $Id: tcp_timer.c,v 1.7 1995/05/30 08:09:59 rgrimes Exp $
*/
#ifndef TUBA_INCLUDE
@@ -63,6 +63,8 @@
int tcp_keepidle = TCPTV_KEEP_IDLE;
int tcp_keepintvl = TCPTV_KEEPINTVL;
int tcp_maxidle;
+int tcp_maxpersistidle = TCPTV_KEEP_IDLE;
+int tcp_totbackoff = 511;
#endif /* TUBA_INCLUDE */
/*
* Fast timeout routine for processing delayed acks
@@ -266,6 +268,20 @@ tcp_timers(tp, timer)
*/
case TCPT_PERSIST:
tcpstat.tcps_persisttimeo++;
+ /*
+ * Hack: if the peer is dead/unreachable, we do not
+ * time out if the window is closed. After a full
+ * backoff, drop the connection if the idle time
+ * (no responses to probes) reaches the maximum
+ * backoff that we would use if retransmitting.
+ */
+ if (tp->t_rxtshift == TCP_MAXRXTSHIFT &&
+ (tp->t_idle >= tcp_maxpersistidle ||
+ tp->t_idle >= TCP_REXMTVAL(tp) * tcp_totbackoff)) {
+ tcpstat.tcps_persistdrop++;
+ tp = tcp_drop(tp, ETIMEDOUT);
+ break;
+ }
tcp_setpersist(tp);
tp->t_force = 1;
(void) tcp_output(tp);
OpenPOWER on IntegriCloud