From 4.4BSD-Lite2:
- When running the slow timers, skip PCBs in LISTEN state. - When processing the persist timer, drop the connection if the connection idle time exceeds the maximum backoff for retransmit. Part of kern/2335 (pete@daemon.net).
This commit is contained in:
parent
82ce1f6a97
commit
04ec3df592
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: tcp_timer.c,v 1.25 1997/12/11 22:47:26 thorpej Exp $ */
|
||||
/* $NetBSD: tcp_timer.c,v 1.26 1997/12/17 06:04:17 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1982, 1986, 1988, 1990, 1993
|
||||
|
@ -62,8 +62,15 @@
|
|||
|
||||
int tcp_keepidle = TCPTV_KEEP_IDLE;
|
||||
int tcp_keepintvl = TCPTV_KEEPINTVL;
|
||||
int tcp_keepcnt = TCPTV_KEEPCNT; /* max idle probes */
|
||||
int tcp_maxpersistidle = TCPTV_KEEP_IDLE; /* max idle time in persist */
|
||||
int tcp_maxidle;
|
||||
#else /* TUBA_INCLUDE */
|
||||
|
||||
extern int tcp_keepcnt;
|
||||
extern int tcp_maxpersistidle;
|
||||
#endif /* TUBA_INCLUDE */
|
||||
|
||||
/*
|
||||
* Fast timeout routine for processing delayed acks
|
||||
*/
|
||||
|
@ -103,7 +110,7 @@ tcp_slowtimo()
|
|||
static int syn_cache_last = 0;
|
||||
|
||||
s = splsoftnet();
|
||||
tcp_maxidle = TCPTV_KEEPCNT * tcp_keepintvl;
|
||||
tcp_maxidle = tcp_keepcnt * tcp_keepintvl;
|
||||
/*
|
||||
* Search through tcb's and update active timers.
|
||||
*/
|
||||
|
@ -115,7 +122,7 @@ tcp_slowtimo()
|
|||
for (; inp != (struct inpcb *)&tcbtable.inpt_queue; inp = ninp) {
|
||||
ninp = inp->inp_queue.cqe_next;
|
||||
tp = intotcpcb(inp);
|
||||
if (tp == 0)
|
||||
if (tp == 0 || tp->t_state == TCPS_LISTEN)
|
||||
continue;
|
||||
for (i = 0; i < TCPT_NTIMERS; i++) {
|
||||
if (tp->t_timer[i] && --tp->t_timer[i] == 0) {
|
||||
|
@ -168,6 +175,8 @@ tcp_canceltimers(tp)
|
|||
int tcp_backoff[TCP_MAXRXTSHIFT + 1] =
|
||||
{ 1, 2, 4, 8, 16, 32, 64, 64, 64, 64, 64, 64, 64 };
|
||||
|
||||
int tcp_totbackoff = 511; /* sum of tcp_backoff[] */
|
||||
|
||||
/*
|
||||
* TCP timer processing.
|
||||
*/
|
||||
|
@ -269,6 +278,20 @@ tcp_timers(tp, timer)
|
|||
* Force a byte to be output, if possible.
|
||||
*/
|
||||
case TCPT_PERSIST:
|
||||
/*
|
||||
* 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_persistdrops++;
|
||||
tp = tcp_drop(tp, ETIMEDOUT);
|
||||
break;
|
||||
}
|
||||
tcpstat.tcps_persisttimeo++;
|
||||
tcp_setpersist(tp);
|
||||
tp->t_force = 1;
|
||||
|
|
Loading…
Reference in New Issue