604 |
|
|
605 |
|
|
606 |
if(flags & TCP_ACK) { |
if(flags & TCP_ACK) { |
607 |
|
unsigned long int right_wnd_edge = pcb->snd_wnd + pcb->snd_wl1; |
608 |
|
|
609 |
/* Update window. */ |
/* Update window. */ |
610 |
if(TCP_SEQ_LT(pcb->snd_wl1, seqno) || |
if(TCP_SEQ_LT(pcb->snd_wl1, seqno) || |
611 |
(pcb->snd_wl1 == seqno && TCP_SEQ_LT(pcb->snd_wl2, ackno)) || |
(pcb->snd_wl1 == seqno && TCP_SEQ_LT(pcb->snd_wl2, ackno)) || |
625 |
|
|
626 |
|
|
627 |
if(pcb->lastack == ackno) { |
if(pcb->lastack == ackno) { |
628 |
++pcb->dupacks; |
if(pcb->snd_wl1+pcb->snd_wnd==right_wnd_edge){ |
629 |
if(pcb->dupacks >= 3 && pcb->unacked != NULL) { |
++pcb->dupacks; |
630 |
if(!(pcb->flags & TF_INFR)) { |
if(pcb->dupacks >= 3 && pcb->unacked != NULL) { |
631 |
/* This is fast retransmit. Retransmit the first unacked segment. */ |
if(!(pcb->flags & TF_INFR)) { |
632 |
DEBUGF(TCP_FR_DEBUG, ("tcp_receive: dupacks %d (%lu), fast retransmit %lu\n", |
/* This is fast retransmit. Retransmit the first unacked segment. */ |
633 |
pcb->dupacks, pcb->lastack, |
DEBUGF(TCP_FR_DEBUG, ("tcp_receive: dupacks %d (%lu), fast retransmit %lu\n", |
634 |
ntohl(pcb->unacked->tcphdr->seqno))); |
pcb->dupacks, pcb->lastack, |
635 |
tcp_rexmit(pcb); |
ntohl(pcb->unacked->tcphdr->seqno))); |
636 |
/* Set ssthresh to max (FlightSize / 2, 2*SMSS) */ |
tcp_rexmit(pcb); |
637 |
pcb->ssthresh = UMAX((pcb->snd_max - |
/* Set ssthresh to max (FlightSize / 2, 2*SMSS) */ |
638 |
pcb->lastack) / 2, |
pcb->ssthresh = UMAX((pcb->snd_max - |
639 |
2 * pcb->mss); |
pcb->lastack) / 2, |
640 |
|
2 * pcb->mss); |
641 |
pcb->cwnd = pcb->ssthresh + 3 * pcb->mss; |
|
642 |
pcb->flags |= TF_INFR; |
pcb->cwnd = pcb->ssthresh + 3 * pcb->mss; |
643 |
} else { |
pcb->flags |= TF_INFR; |
644 |
/* Inflate the congestion window, but not if it means that |
} else { |
645 |
the value overflows. */ |
/* Inflate the congestion window, but not if it means that |
646 |
if((u16_t)(pcb->cwnd + pcb->mss) > pcb->cwnd) { |
the value overflows. */ |
647 |
pcb->cwnd += pcb->mss; |
if((u16_t)(pcb->cwnd + pcb->mss) > pcb->cwnd) { |
648 |
|
pcb->cwnd += pcb->mss; |
649 |
|
} |
650 |
} |
} |
651 |
|
} |
652 |
} |
} |
653 |
|
else{ |
654 |
|
DEBUGF(TCP_FR_DEBUG, ("tcp_receive: dupack averted %lu %lu\n", pcb->snd_wl1+pcb->snd_wnd, right_wnd_edge)); |
655 |
} |
} |
656 |
} else if(TCP_SEQ_LT(pcb->lastack, ackno) && |
} else if(TCP_SEQ_LT(pcb->lastack, ackno) && |
657 |
TCP_SEQ_LEQ(ackno, pcb->snd_max)) { |
TCP_SEQ_LEQ(ackno, pcb->snd_max)) { |