X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/2d21ac55c334faf3a56e5634905ed6987fc787d4..ca66cea69e6e866fd781ae2260d9474bdd48f2ca:/bsd/netinet/tcp_timer.c diff --git a/bsd/netinet/tcp_timer.c b/bsd/netinet/tcp_timer.c index 739e2816b..e8de99b71 100644 --- a/bsd/netinet/tcp_timer.c +++ b/bsd/netinet/tcp_timer.c @@ -358,7 +358,7 @@ static int bg_cnt = 0; void tcp_slowtimo() { - struct inpcb *inp; + struct inpcb *inp, *nxt; struct tcpcb *tp; struct socket *so; int i; @@ -537,12 +537,12 @@ twunlock: } - LIST_FOREACH(inp, &tcb, inp_list) { + LIST_FOREACH_SAFE(inp, &tcb, inp_list, nxt) { tcp_garbage_collect(inp, 0); } /* Now cleanup the time wait ones */ - LIST_FOREACH(inp, &time_wait_slots[cur_tw_slot], inp_list) { + LIST_FOREACH_SAFE(inp, &time_wait_slots[cur_tw_slot], inp_list, nxt) { tcp_garbage_collect(inp, 1); } @@ -729,15 +729,15 @@ tcp_timers(tp, timer) * growth is 2 mss. We don't allow the threshhold * to go below this.) */ - { - u_int win = min(tp->snd_wnd, tp->snd_cwnd) / 2 / tp->t_maxseg; - if (win < 2) - win = 2; - tp->snd_cwnd = tp->t_maxseg; - tp->snd_ssthresh = win * tp->t_maxseg; - tp->t_bytes_acked = 0; - tp->t_dupacks = 0; - tp->t_unacksegs = 0; + if (tp->t_state >= TCPS_ESTABLISHED) { + u_int win = min(tp->snd_wnd, tp->snd_cwnd) / 2 / tp->t_maxseg; + if (win < 2) + win = 2; + tp->snd_cwnd = tp->t_maxseg; + tp->snd_ssthresh = win * tp->t_maxseg; + tp->t_bytes_acked = 0; + tp->t_dupacks = 0; + tp->t_unacksegs = 0; } EXIT_FASTRECOVERY(tp); (void) tcp_output(tp);