src/internet/model/tcp-tahoe.cc
changeset 10440 1e48ff9185f1
parent 10410 4d4eb8097fa3
child 10652 dc18deba4502
equal deleted inserted replaced
10439:73bc9e55f9bd 10440:1e48ff9185f1
    70 
    70 
    71 TcpTahoe::~TcpTahoe (void)
    71 TcpTahoe::~TcpTahoe (void)
    72 {
    72 {
    73 }
    73 }
    74 
    74 
    75 /** We initialize m_cWnd from this function, after attributes initialized */
    75 /* We initialize m_cWnd from this function, after attributes initialized */
    76 int
    76 int
    77 TcpTahoe::Listen (void)
    77 TcpTahoe::Listen (void)
    78 {
    78 {
    79   NS_LOG_FUNCTION (this);
    79   NS_LOG_FUNCTION (this);
    80   InitializeCwnd ();
    80   InitializeCwnd ();
    81   return TcpSocketBase::Listen ();
    81   return TcpSocketBase::Listen ();
    82 }
    82 }
    83 
    83 
    84 /** We initialize m_cWnd from this function, after attributes initialized */
    84 /* We initialize m_cWnd from this function, after attributes initialized */
    85 int
    85 int
    86 TcpTahoe::Connect (const Address & address)
    86 TcpTahoe::Connect (const Address & address)
    87 {
    87 {
    88   NS_LOG_FUNCTION (this << address);
    88   NS_LOG_FUNCTION (this << address);
    89   InitializeCwnd ();
    89   InitializeCwnd ();
    90   return TcpSocketBase::Connect (address);
    90   return TcpSocketBase::Connect (address);
    91 }
    91 }
    92 
    92 
    93 /** Limit the size of in-flight data by cwnd and receiver's rxwin */
    93 /* Limit the size of in-flight data by cwnd and receiver's rxwin */
    94 uint32_t
    94 uint32_t
    95 TcpTahoe::Window (void)
    95 TcpTahoe::Window (void)
    96 {
    96 {
    97   NS_LOG_FUNCTION (this);
    97   NS_LOG_FUNCTION (this);
    98   return std::min (m_rWnd.Get (), m_cWnd.Get ());
    98   return std::min (m_rWnd.Get (), m_cWnd.Get ());
   102 TcpTahoe::Fork (void)
   102 TcpTahoe::Fork (void)
   103 {
   103 {
   104   return CopyObject<TcpTahoe> (this);
   104   return CopyObject<TcpTahoe> (this);
   105 }
   105 }
   106 
   106 
   107 /** New ACK (up to seqnum seq) received. Increase cwnd and call TcpSocketBase::NewAck() */
   107 /* New ACK (up to seqnum seq) received. Increase cwnd and call TcpSocketBase::NewAck() */
   108 void
   108 void
   109 TcpTahoe::NewAck (SequenceNumber32 const& seq)
   109 TcpTahoe::NewAck (SequenceNumber32 const& seq)
   110 {
   110 {
   111   NS_LOG_FUNCTION (this << seq);
   111   NS_LOG_FUNCTION (this << seq);
   112   NS_LOG_LOGIC ("TcpTahoe receieved ACK for seq " << seq <<
   112   NS_LOG_LOGIC ("TcpTahoe receieved ACK for seq " << seq <<
   126       NS_LOG_INFO ("In CongAvoid, updated to cwnd " << m_cWnd << " ssthresh " << m_ssThresh);
   126       NS_LOG_INFO ("In CongAvoid, updated to cwnd " << m_cWnd << " ssthresh " << m_ssThresh);
   127     }
   127     }
   128   TcpSocketBase::NewAck (seq);           // Complete newAck processing
   128   TcpSocketBase::NewAck (seq);           // Complete newAck processing
   129 }
   129 }
   130 
   130 
   131 /** Cut down ssthresh upon triple dupack */
   131 /* Cut down ssthresh upon triple dupack */
   132 void
   132 void
   133 TcpTahoe::DupAck (const TcpHeader& t, uint32_t count)
   133 TcpTahoe::DupAck (const TcpHeader& t, uint32_t count)
   134 {
   134 {
   135   NS_LOG_FUNCTION (this << "t " << count);
   135   NS_LOG_FUNCTION (this << "t " << count);
   136   if (count == m_retxThresh)
   136   if (count == m_retxThresh)
   146       NS_LOG_LOGIC ("Triple Dup Ack: retransmit missing segment at " << Simulator::Now ().GetSeconds ());
   146       NS_LOG_LOGIC ("Triple Dup Ack: retransmit missing segment at " << Simulator::Now ().GetSeconds ());
   147       DoRetransmit ();
   147       DoRetransmit ();
   148     }
   148     }
   149 }
   149 }
   150 
   150 
   151 /** Retransmit timeout */
   151 /* Retransmit timeout */
   152 void TcpTahoe::Retransmit (void)
   152 void TcpTahoe::Retransmit (void)
   153 {
   153 {
   154   NS_LOG_FUNCTION (this);
   154   NS_LOG_FUNCTION (this);
   155   NS_LOG_LOGIC (this << " ReTxTimeout Expired at time " << Simulator::Now ().GetSeconds ());
   155   NS_LOG_LOGIC (this << " ReTxTimeout Expired at time " << Simulator::Now ().GetSeconds ());
   156   // If erroneous timeout in closed/timed-wait state, just return
   156   // If erroneous timeout in closed/timed-wait state, just return