diff options
author | dg <dg@FreeBSD.org> | 1995-07-29 18:48:44 +0000 |
---|---|---|
committer | dg <dg@FreeBSD.org> | 1995-07-29 18:48:44 +0000 |
commit | 03d42e175c7226e547963c027ae9cd0dc0a518ea (patch) | |
tree | f0e3e8247b87e2cfe3801469917d01acb4b4dbcc /sys | |
parent | cd6ef599be54727e4f352b8d862c7a4dc4186b90 (diff) | |
download | FreeBSD-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')
-rw-r--r-- | sys/netinet/tcp_timer.c | 18 | ||||
-rw-r--r-- | sys/netinet/tcp_var.h | 3 |
2 files changed, 19 insertions, 2 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); diff --git a/sys/netinet/tcp_var.h b/sys/netinet/tcp_var.h index 6b69091..a21c899 100644 --- a/sys/netinet/tcp_var.h +++ b/sys/netinet/tcp_var.h @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)tcp_var.h 8.3 (Berkeley) 4/10/94 - * $Id: tcp_var.h,v 1.13 1995/06/29 18:11:24 wollman Exp $ + * $Id: tcp_var.h,v 1.14 1995/07/10 15:39:16 wollman Exp $ */ #ifndef _NETINET_TCP_VAR_H_ @@ -239,6 +239,7 @@ struct tcpstat { u_long tcps_timeoutdrop; /* conn. dropped in rxmt timeout */ u_long tcps_rexmttimeo; /* retransmit timeouts */ u_long tcps_persisttimeo; /* persist timeouts */ + u_long tcps_persistdrop; /* conns dropped by persist timeout */ u_long tcps_keeptimeo; /* keepalive timeouts */ u_long tcps_keepprobe; /* keepalive probes sent */ u_long tcps_keepdrops; /* connections dropped in keepalive */ |