#include <TCPTahoe.h>
  
Public Member Functions | |
| TCPTahoe () | |
| virtual void | receivedDataAck (uint32 firstSeqAcked) | 
| virtual void | receivedDuplicateAck () | 
Protected Member Functions | |
| virtual TCPStateVariables * | createStateVariables () | 
| virtual void | recalculateSlowStartThreshold () | 
| virtual void | processRexmitTimer (TCPEventCode &event) | 
Protected Attributes | |
| TCPTahoeStateVariables *& | state | 
Implements Tahoe.
Definition at line 34 of file TCPTahoe.h.
| TCPTahoe::TCPTahoe | ( | ) | 
Ctor
Definition at line 26 of file flavours/TCPTahoe.cc.
: TCPTahoeRenoFamily(), state((TCPTahoeStateVariables *&)TCPAlgorithm::state) { }
| virtual TCPStateVariables* TCPTahoe::createStateVariables | ( | ) |  [inline, protected, virtual] | 
        
Create and return a TCPTahoeStateVariables object.
Implements TCPAlgorithm.
Definition at line 41 of file TCPTahoe.h.
                                                      {
        return new TCPTahoeStateVariables();
    }
| void TCPTahoe::processRexmitTimer | ( | TCPEventCode & | event | ) |  [protected, virtual] | 
        
Redefine what should happen on retransmission
Reimplemented from TCPBaseAlg.
Definition at line 41 of file flavours/TCPTahoe.cc.
{
    TCPTahoeRenoFamily::processRexmitTimer(event);
    if (event==TCP_E_ABORT)
        return;
    // begin Slow Start (RFC 2581)
    recalculateSlowStartThreshold();
    state->snd_cwnd = state->snd_mss;
    if (cwndVector) cwndVector->record(state->snd_cwnd);
    tcpEV << "Begin Slow Start: resetting cwnd to " << state->snd_cwnd
          << ", ssthresh=" << state->ssthresh << "\n";
    state->afterRto = true;
    // Tahoe retransmits only one segment at the front of the queue
    conn->retransmitOneSegment(true);
}
| void TCPTahoe::recalculateSlowStartThreshold | ( | ) |  [protected, virtual] | 
        
Utility function to recalculate ssthresh
Definition at line 31 of file flavours/TCPTahoe.cc.
Referenced by processRexmitTimer(), and receivedDuplicateAck().
{
    // set ssthresh to flight size/2, but at least 2 MSS
    // (the formula below practically amounts to ssthresh=cwnd/2 most of the time)
    uint32 flight_size = std::min(state->snd_cwnd, state->snd_wnd); // FIXME TODO - Does this formula computes the amount of outstanding data?
    // uint32 flight_size = state->snd_max - state->snd_una;
    state->ssthresh = std::max(flight_size/2, 2*state->snd_mss);
    if (ssthreshVector) ssthreshVector->record(state->ssthresh);
}
| void TCPTahoe::receivedDataAck | ( | uint32 | firstSeqAcked | ) |  [virtual] | 
        
Redefine what should happen when data got acked, to add congestion window management
Reimplemented from TCPBaseAlg.
Definition at line 60 of file flavours/TCPTahoe.cc.
{
    TCPTahoeRenoFamily::receivedDataAck(firstSeqAcked);
    //
    // Perform slow start and congestion avoidance.
    //
    if (state->snd_cwnd < state->ssthresh)
    {
        tcpEV << "cwnd<=ssthresh: Slow Start: increasing cwnd by SMSS bytes to ";
        // perform Slow Start. RFC 2581: "During slow start, a TCP increments cwnd
        // by at most SMSS bytes for each ACK received that acknowledges new data."
        state->snd_cwnd += state->snd_mss;
        // Note: we could increase cwnd based on the number of bytes being
        // acknowledged by each arriving ACK, rather than by the number of ACKs
        // that arrive. This is called "Appropriate Byte Counting" (ABC) and is
        // described in RFC 3465 (experimental).
        //
        // int bytesAcked = state->snd_una - firstSeqAcked;
        // state->snd_cwnd += bytesAcked;
        if (cwndVector) cwndVector->record(state->snd_cwnd);
        tcpEV << "cwnd=" << state->snd_cwnd << "\n";
    }
    else
    {
        // perform Congestion Avoidance (RFC 2581)
        int incr = state->snd_mss * state->snd_mss / state->snd_cwnd;
        if (incr==0)
            incr = 1;
        state->snd_cwnd += incr;
        if (cwndVector) cwndVector->record(state->snd_cwnd);
        //
        // Note: some implementations use extra additive constant mss/8 here
        // which is known to be incorrect (RFC 2581 p5)
        //
        // Note 2: RFC 3465 (experimental) "Appropriate Byte Counting" (ABC)
        // would require maintaining a bytes_acked variable here which we don't do
        //
        tcpEV << "cwnd>ssthresh: Congestion Avoidance: increasing cwnd linearly, to " << state->snd_cwnd << "\n";
    }
    // ack and/or cwnd increase may have freed up some room in the window, try sending
    sendData();
}
| void TCPTahoe::receivedDuplicateAck | ( | ) |  [virtual] | 
        
Redefine what should happen when dupAck was received, to add congestion window management
Reimplemented from TCPBaseAlg.
Definition at line 111 of file flavours/TCPTahoe.cc.
{
    TCPTahoeRenoFamily::receivedDuplicateAck();
    if (state->dupacks==DUPTHRESH) // DUPTHRESH = 3
    {
        tcpEV << "Tahoe on dupAck=DUPTHRESH(=3): perform Fast Retransmit, and enter Slow Start:\n";
        // enter Slow Start
        recalculateSlowStartThreshold();
        state->snd_cwnd = state->snd_mss;
        if (cwndVector) cwndVector->record(state->snd_cwnd);
        tcpEV << "Set cwnd=" << state->snd_cwnd << ", ssthresh=" << state->ssthresh << "\n";
        // Fast Retransmission: retransmit missing segment without waiting
        // for the REXMIT timer to expire
        conn->retransmitOneSegment(false);
        // Do not restart REXMIT timer.
        // Note: Restart of REXMIT timer on retransmission is not part of RFC 2581, however optional in RFC 3517 if sent during recovery.
        // Resetting the REXMIT timer is discussed in RFC 2582/3782 (NewReno) and RFC 2988.
    }
}
TCPTahoeStateVariables*& TCPTahoe::state [protected] | 
        
Reimplemented from TCPTahoeRenoFamily.
Definition at line 37 of file TCPTahoe.h.
Referenced by processRexmitTimer(), recalculateSlowStartThreshold(), receivedDataAck(), and receivedDuplicateAck().
 1.7.1