/* tcp_timer.c 4.5 81/12/02 */
#include "../h/socketvar.h"
#include "../h/protosw.h"
#include "../net/in_pcb.h"
#include "../net/in_systm.h"
#include "../net/ip_var.h"
#include "../net/tcp_fsm.h"
#include "../net/tcp_seq.h"
#include "../net/tcp_timer.h"
#include "../net/tcp_var.h"
#include "../net/tcpip.h"
* Fast timeout routine for processing delayed acks
* Tcp protocol timeout routine called every 500 ms.
* Updates the timers in all active tcb's and
* causes finite state machine actions if timers expire.
register struct inpcb
*ip
;
register struct tcpcb
*tp
;
* Search through tcb's and update active timers.
for (ip
= tcb
.inp_next
; ip
!= &tcb
; ip
= ip
->inp_next
) {
for (i
= 0; i
< TCPT_NTIMERS
; i
++) {
if (tp
->t_timer
[i
] && --tp
->t_timer
[i
] == 0)
(void) tcp_usrreq(tp
->t_inpcb
->inp_socket
,
PRU_SLOWTIMO
, (struct mbuf
*)0,
tcp_iss
+= TCP_ISSINCR
/PR_SLOWHZ
; /* increment iss */
* Cancel all timers for TCP tp.
for (i
= 0; i
< TCPT_NTIMERS
; i
++)
register struct tcpcb
*tp
;
* 2 MSL timeout in shutdown went off. Delete connection
* Retransmission timer went off. Message has not
* been acked within retransmit interval. Back off
* to a longer retransmit interval and retransmit all
* unacknowledged messages in the window.
TCPT_RANGESET(tp
->t_timer
[TCPT_REXMT
],
((int)(2 * tp
->t_srtt
)) << tp
->t_rxtshift
,
tp
->snd_nxt
= tp
->snd_una
;
/* this only transmits one segment! */
* Persistance timer into zero window.
* Force a byte to be output, if possible.
TCPT_RANGESET(tp
->t_timer
[TCPT_PERSIST
],
2 * tp
->t_srtt
, TCPTV_PERSMIN
, TCPTV_MAX
);
* Keep-alive timer went off; send something
* or drop connection if idle for too long.
if (tp
->t_state
< TCPS_ESTABLISHED
||
tp
->t_idle
>= TCPTV_MAXIDLE
) {
tcp_respond(tp
->t_template
, tp
->rcv_nxt
, tp
->snd_una
-1, 0);
tp
->t_timer
[TCPT_KEEP
] = TCPTV_KEEP
;