void
tcp_slowtimo()
{
- struct inpcb *inp;
+ struct inpcb *inp, *nxt;
struct tcpcb *tp;
struct socket *so;
int i;
}
- 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);
}
* 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);