/* tcp_timer.c 4.13 82/01/19 */
#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
register struct inpcb
*inp
;
register struct tcpcb
*tp
;
for (inp
= tcb
.inp_next
; inp
!= &tcb
; inp
= inp
->inp_next
)
if ((tp
= (struct tcpcb
*)inp
->inp_ppcb
) &&
(tp
->t_flags
& TF_DELACK
)) {
tp
->t_flags
&= ~TF_DELACK
;
tp
->t_flags
|= TF_ACKNOW
;
* 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
; 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
],
TCPT_RANGESET(tp
->t_timer
[TCPT_REXMT
],
tp
->t_timer
[TCPT_REXMT
] << tp
->t_rxtshift
,
if (tp
->t_timer
[TCPT_REXMT
] > TCPTV_MAXIDLE
/ 2) {
/* printf("rexmt set to %d\n", tp->t_timer[TCPT_REXMT]); */
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
) {
if (tp
->t_inpcb
->inp_socket
->so_options
& SO_NOKEEPALIVE
)
tp
->t_template
, tp
->rcv_nxt
, tp
->snd_una
-1, 0);
tp
->t_timer
[TCPT_KEEP
] = TCPTV_KEEP
;
* Out-of-band data retransmit timer.
if (tp
->t_flags
& TF_NOOPT
)
TCPT_RANGESET(tp
->t_timer
[TCPT_OOBREXMT
],
2 * tp
->t_srtt
, TCPTV_MIN
, TCPTV_MAX
);