actually send keepalives at tcp_keepintvl half-seconds.

previously, tcp_timer.c would arm the timer at tcp_keepintvl half-seconds
in tcp_timer_keep(), but then the code touched in the diff below would
reset it to tcp_keepidle half-seconds instead

any comments?
ok?

Index: netinet/tcp_input.c
===================================================================
RCS file: /cvs/src/sys/netinet/tcp_input.c,v
retrieving revision 1.250
diff -u -p -r1.250 tcp_input.c
--- netinet/tcp_input.c 13 May 2011 14:31:16 -0000      1.250
+++ netinet/tcp_input.c 14 Jun 2011 15:17:50 -0000
@@ -961,8 +961,13 @@ findpcb:
         * Reset idle time and keep-alive timer.
         */
        tp->t_rcvtime = tcp_now;
-       if (TCPS_HAVEESTABLISHED(tp->t_state))
-               TCP_TIMER_ARM(tp, TCPT_KEEP, tcp_keepidle);
+       if (TCPS_HAVEESTABLISHED(tp->t_state)) {
+               if (tcp_always_keepalive ||
+                   tp->t_inpcb->inp_socket->so_options & SO_KEEPALIVE)
+                       TCP_TIMER_ARM(tp, TCPT_KEEP, tcp_keepintvl);
+               else
+                       TCP_TIMER_ARM(tp, TCPT_KEEP, tcp_keepidle);
+       }
 
 #ifdef TCP_SACK
        if (tp->sack_enable)

Reply via email to