641 |
} else { |
} else { |
642 |
/* Inflate the congestion window, but not if it means that |
/* Inflate the congestion window, but not if it means that |
643 |
the value overflows. */ |
the value overflows. */ |
644 |
if(pcb->cwnd + pcb->mss > pcb->cwnd) { |
if((u16_t)(pcb->cwnd + pcb->mss) > pcb->cwnd) { |
645 |
pcb->cwnd += pcb->mss; |
pcb->cwnd += pcb->mss; |
646 |
} |
} |
647 |
|
|
677 |
ssthresh). */ |
ssthresh). */ |
678 |
if(pcb->state >= ESTABLISHED) { |
if(pcb->state >= ESTABLISHED) { |
679 |
if(pcb->cwnd < pcb->ssthresh) { |
if(pcb->cwnd < pcb->ssthresh) { |
680 |
if(pcb->cwnd + pcb->mss > pcb->cwnd) { |
if((u16_t)(pcb->cwnd + pcb->mss) > pcb->cwnd) { |
681 |
pcb->cwnd += pcb->mss; |
pcb->cwnd += pcb->mss; |
682 |
} |
} |
683 |
DEBUGF(TCP_CWND_DEBUG, ("tcp_receive: slow start cwnd %u\n", pcb->cwnd)); |
DEBUGF(TCP_CWND_DEBUG, ("tcp_receive: slow start cwnd %u\n", pcb->cwnd)); |
684 |
} else { |
} else { |
685 |
if(pcb->cwnd + pcb->mss * pcb->mss / pcb->cwnd > pcb->cwnd) { |
u16_t new_cwnd = (pcb->cwnd + pcb->mss * pcb->mss / pcb->cwnd); |
686 |
pcb->cwnd += pcb->mss * pcb->mss / pcb->cwnd; |
if(new_cwnd > pcb->cwnd) { |
687 |
|
pcb->cwnd = new_cwnd; |
688 |
} |
} |
689 |
DEBUGF(TCP_CWND_DEBUG, ("tcp_receive: congestion avoidance cwnd %u\n", pcb->cwnd)); |
DEBUGF(TCP_CWND_DEBUG, ("tcp_receive: congestion avoidance cwnd %u\n", pcb->cwnd)); |
690 |
} |
} |
691 |
} |
} |
692 |
DEBUGF(TCP_INPUT_DEBUG, ("tcp_receive: ACK for %lu, unacked->seqno %lu:%lu\n", |
DEBUGF(TCP_INPUT_DEBUG, ("tcp_receive: ACK for %lu, unacked->seqno %lu:%lu\n", |