fix up FIN_WAIT_2 timeout: don't send keepalives, as the reset
authorMike Karels <karels@ucbvax.Berkeley.EDU>
Sun, 20 Apr 1986 11:59:22 +0000 (03:59 -0800)
committerMike Karels <karels@ucbvax.Berkeley.EDU>
Sun, 20 Apr 1986 11:59:22 +0000 (03:59 -0800)
won't be received, but will reset idle time; don't reset idle time unless
packet received

SCCS-vsn: sys/netinet/tcp_timer.c 6.14

usr/src/sys/netinet/tcp_timer.c

index 4d63bfe..6ac13e1 100644 (file)
@@ -3,7 +3,7 @@
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
- *     @(#)tcp_timer.c 6.13 (Berkeley) %G%
+ *     @(#)tcp_timer.c 6.14 (Berkeley) %G%
  */
 
 #include "param.h"
  */
 
 #include "param.h"
@@ -193,7 +193,8 @@ tcp_timers(tp, timer)
        case TCPT_KEEP:
                if (tp->t_state < TCPS_ESTABLISHED)
                        goto dropit;
        case TCPT_KEEP:
                if (tp->t_state < TCPS_ESTABLISHED)
                        goto dropit;
-               if (tp->t_inpcb->inp_socket->so_options & SO_KEEPALIVE) {
+               if (tp->t_inpcb->inp_socket->so_options & SO_KEEPALIVE &&
+                   tp->t_state <= TCPS_CLOSE_WAIT) {
                        if (tp->t_idle >= TCPTV_MAXIDLE)
                                goto dropit;
                        /*
                        if (tp->t_idle >= TCPTV_MAXIDLE)
                                goto dropit;
                        /*
@@ -208,8 +209,7 @@ tcp_timers(tp, timer)
                         */
                        tcp_respond(tp,
                            tp->t_template, tp->rcv_nxt-1, tp->snd_una-1, 0);
                         */
                        tcp_respond(tp,
                            tp->t_template, tp->rcv_nxt-1, tp->snd_una-1, 0);
-               } else
-                       tp->t_idle = 0;
+               }
                tp->t_timer[TCPT_KEEP] = TCPTV_KEEP;
                break;
        dropit:
                tp->t_timer[TCPT_KEEP] = TCPTV_KEEP;
                break;
        dropit: