Two fixes from Rich Stevens:

1) Set the persist timer to help time-out connections in the CLOSING state.
2) Honor the keep-alive timer in the CLOSING state.

   This fixes problems with connections getting "stuck" due to incompletion
of the final connection shutdown which can be a BIG problem on busy WWW
servers.
This commit is contained in:
David Greenman 1996-04-15 03:46:33 +00:00
parent 68159c8901
commit 2d8266af5c
2 changed files with 10 additions and 7 deletions

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* @(#)tcp_output.c 8.4 (Berkeley) 5/24/95 * @(#)tcp_output.c 8.4 (Berkeley) 5/24/95
* $Id: tcp_output.c,v 1.18 1996/01/17 09:35:23 olah Exp $ * $Id: tcp_output.c,v 1.19 1996/03/11 15:13:32 davidg Exp $
*/ */
#include <sys/param.h> #include <sys/param.h>
@ -186,15 +186,18 @@ again:
* but we haven't been called to retransmit, * but we haven't been called to retransmit,
* len will be -1. Otherwise, window shrank * len will be -1. Otherwise, window shrank
* after we sent into it. If window shrank to 0, * after we sent into it. If window shrank to 0,
* cancel pending retransmit and pull snd_nxt * cancel pending retransmit, pull snd_nxt back
* back to (closed) window. We will enter persist * to (closed) window, and set the persist timer
* state below. If the window didn't close completely, * if it isn't already going. If the window didn't
* just wait for an ACK. * close completely, just wait for an ACK.
*/ */
len = 0; len = 0;
if (win == 0) { if (win == 0) {
tp->t_timer[TCPT_REXMT] = 0; tp->t_timer[TCPT_REXMT] = 0;
tp->t_rxtshift = 0;
tp->snd_nxt = tp->snd_una; tp->snd_nxt = tp->snd_una;
if (tp->t_timer[TCPT_PERSIST] == 0)
tcp_setpersist(tp);
} }
} }
if (len > tp->t_maxseg) { if (len > tp->t_maxseg) {

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* @(#)tcp_timer.c 8.2 (Berkeley) 5/24/95 * @(#)tcp_timer.c 8.2 (Berkeley) 5/24/95
* $Id: tcp_timer.c,v 1.14 1996/03/11 15:13:35 davidg Exp $ * $Id: tcp_timer.c,v 1.15 1996/04/04 11:17:04 phk Exp $
*/ */
#ifndef TUBA_INCLUDE #ifndef TUBA_INCLUDE
@ -320,7 +320,7 @@ tcp_timers(tp, timer)
goto dropit; goto dropit;
if ((always_keepalive || if ((always_keepalive ||
tp->t_inpcb->inp_socket->so_options & SO_KEEPALIVE) && tp->t_inpcb->inp_socket->so_options & SO_KEEPALIVE) &&
tp->t_state <= TCPS_CLOSE_WAIT) { tp->t_state <= TCPS_CLOSING) {
if (tp->t_idle >= tcp_keepidle + tcp_maxidle) if (tp->t_idle >= tcp_keepidle + tcp_maxidle)
goto dropit; goto dropit;
/* /*