public class SenderStateCongestionAvoidance extends SenderState
after3xDupACKstate, congestionAvoidanceState, sender, slowStartState
Constructor and Description |
---|
SenderStateCongestionAvoidance(Sender sender,
SenderState slowStartState,
SenderState after3xDupACKstate)
Constructor for the congestion avoidance state of a TCP sender.
|
Modifier and Type | Method and Description |
---|---|
protected int |
calcCongWinAfterNewAck(int ackSequenceNumber_,
int lastByteAcked_)
Helper method to calculate the new value of the congestion
window after a "new ACK" is received that acknowledges
data never acknowledged before.
This method also resets the RTO timer for any outstanding segments. |
protected SenderState |
lookupNextStateAfterNewAck()
Helper method to look-up the next state
that the sender will transition to after this one.
|
(package private) void |
setAfter3xDupACKstate(SenderState after3xDupACKstate)
The reason for this method is that the constructors
SenderStateCongestionAvoidance and SenderStateFastRecovery
need each other, so one has to be created first, and then
the other will be set using this method.Thus package visibility only. |
handleDupACK, handleNewACK, handleRTOtimeout
public SenderStateCongestionAvoidance(Sender sender, SenderState slowStartState, SenderState after3xDupACKstate)
sender
- slowStartState
- Slow start stateafter3xDupACKstate
- State to enter after three duplicate-ACKs are received (different for Tahoe vs. Reno)protected int calcCongWinAfterNewAck(int ackSequenceNumber_, int lastByteAcked_)
RFC 5681 says that during congestion avoidance, TCP sender must not increase its congestion window by more than MSS bytes per round-trip time (RTT).
RFC 5681 describes several ways of how this can be achieved. The recommended way to increase CongWin during congestion avoidance is to count the number of bytes that have been acknowledged by ACKs for new data. When the number of bytes acknowledged reaches CongWin, then CongWin can be incremented by up to MSS bytes.
Another common method is to use the formula:
CongWin += MSS*MSS/CongWinNote that for a connection where the receiver sends cumulative ACKs, this formula will lead to increasing CongWin by less than 1 full-sized segment per RTT.
calcCongWinAfterNewAck
in class SenderState
ackSequenceNumber_
- acknowledged data sequence numberlastByteAcked_
- last byte previously acknowledged (not yet updated with this new ACK!)protected SenderState lookupNextStateAfterNewAck()
lookupNextStateAfterNewAck
in class SenderState
void setAfter3xDupACKstate(SenderState after3xDupACKstate)
SenderStateCongestionAvoidance
and SenderStateFastRecovery
need each other, so one has to be created first, and then
the other will be set using this method.after3xDupACKstate
- the after3xDupACKstate to set