View | Details | Raw Unified | Return to bug 2220
Collapse All | Expand All

(-)i/src/internet/model/tcp-socket-base.cc (-9 / +28 lines)
 Lines 190-196   TcpSocketBase::TcpSocketBase (void) Link Here 
190
    m_sndScaleFactor (0),
190
    m_sndScaleFactor (0),
191
    m_rcvScaleFactor (0),
191
    m_rcvScaleFactor (0),
192
    m_timestampEnabled (true),
192
    m_timestampEnabled (true),
193
    m_timestampToEcho (0)
193
    m_timestampToEcho (0),
194
    m_isRealRTO (true)
194
195
195
{
196
{
196
  NS_LOG_FUNCTION (this);
197
  NS_LOG_FUNCTION (this);
 Lines 237-244   TcpSocketBase::TcpSocketBase (const TcpSocketBase& sock) Link Here 
237
    m_sndScaleFactor (sock.m_sndScaleFactor),
238
    m_sndScaleFactor (sock.m_sndScaleFactor),
238
    m_rcvScaleFactor (sock.m_rcvScaleFactor),
239
    m_rcvScaleFactor (sock.m_rcvScaleFactor),
239
    m_timestampEnabled (sock.m_timestampEnabled),
240
    m_timestampEnabled (sock.m_timestampEnabled),
240
    m_timestampToEcho (sock.m_timestampToEcho)
241
    m_timestampToEcho (sock.m_timestampToEcho),
241
242
    m_isRealRTO (sock.m_isRealRTO)
242
{
243
{
243
  NS_LOG_FUNCTION (this);
244
  NS_LOG_FUNCTION (this);
244
  NS_LOG_LOGIC ("Invoked the copy constructor");
245
  NS_LOG_LOGIC ("Invoked the copy constructor");
 Lines 2242-2256   TcpSocketBase::NewAck (SequenceNumber32 const& ack) Link Here 
2242
    { // Set RTO unless the ACK is received in SYN_RCVD state
2243
    { // Set RTO unless the ACK is received in SYN_RCVD state
2243
      NS_LOG_LOGIC (this << " Cancelled ReTxTimeout event which was set to expire at " <<
2244
      NS_LOG_LOGIC (this << " Cancelled ReTxTimeout event which was set to expire at " <<
2244
                    (Simulator::Now () + Simulator::GetDelayLeft (m_retxEvent)).GetSeconds ());
2245
                    (Simulator::Now () + Simulator::GetDelayLeft (m_retxEvent)).GetSeconds ());
2245
      m_retxEvent.Cancel ();
2246
2246
      // On receiving a "New" ack we restart retransmission timer .. RFC 6298
2247
      // On receiving a "New" ack we restart retransmission timer .. RFC 6298
2247
      // RFC 6298, clause 2.4
2248
      // RFC 6298, clause 2.4
2248
      m_rto = Max (m_rtt->GetEstimate () + Max (m_clockGranularity, m_rtt->GetVariation ()*4), m_minRto);
2249
      m_rto = Max (m_rtt->GetEstimate () + Max (m_clockGranularity, m_rtt->GetVariation ()*4), m_minRto);
2249
2250
2250
      NS_LOG_LOGIC (this << " Schedule ReTxTimeout at time " <<
2251
      if (Simulator::Now () + m_rto > Simulator::Now() + Simulator::GetDelayLeft (m_retxEvent))
2251
                    Simulator::Now ().GetSeconds () << " to expire at time " <<
2252
        {
2252
                    (Simulator::Now () + m_rto.Get ()).GetSeconds ());
2253
          m_isRealRTO = false;
2253
      m_retxEvent = Simulator::Schedule (m_rto, &TcpSocketBase::ReTxTimeout, this);
2254
          m_realRTO = Simulator::Now () + m_rto;
2255
        }
2256
      else
2257
        {
2258
          m_isRealRTO = true;
2259
          m_retxEvent.Cancel ();
2260
          NS_LOG_LOGIC (this << " Schedule ReTxTimeout at time " <<
2261
                              Simulator::Now ().GetSeconds () << " to expire at time " <<
2262
                              (Simulator::Now () + m_rto.Get ()).GetSeconds ());
2263
          m_retxEvent = Simulator::Schedule (m_rto, &TcpSocketBase::ReTxTimeout, this);
2264
        }
2254
    }
2265
    }
2255
  if (m_rWnd.Get () == 0 && m_persistEvent.IsExpired ())
2266
  if (m_rWnd.Get () == 0 && m_persistEvent.IsExpired ())
2256
    { // Zero window: Enter persist state to send 1 byte to probe
2267
    { // Zero window: Enter persist state to send 1 byte to probe
 Lines 2294-2300   void Link Here 
2294
TcpSocketBase::ReTxTimeout ()
2305
TcpSocketBase::ReTxTimeout ()
2295
{
2306
{
2296
  NS_LOG_FUNCTION (this);
2307
  NS_LOG_FUNCTION (this);
2297
  NS_LOG_LOGIC (this << " ReTxTimeout Expired at time " << Simulator::Now ().GetSeconds ());
2308
2309
  if (! m_isRealRTO && m_realRTO > Simulator::Now ())
2310
    {
2311
      m_retxEvent = Simulator::Schedule (m_realRTO-Simulator::Now (),
2312
                                         &TcpSocketBase::ReTxTimeout, this);
2313
      return;
2314
    }
2315
2316
  NS_LOG_INFO (this << " ReTxTimeout Expired at time " << Simulator::Now ().GetSeconds ());
2298
  // If erroneous timeout in closed/timed-wait state, just return
2317
  // If erroneous timeout in closed/timed-wait state, just return
2299
  if (m_state == CLOSED || m_state == TIME_WAIT)
2318
  if (m_state == CLOSED || m_state == TIME_WAIT)
2300
    {
2319
    {
(-)i/src/internet/model/tcp-socket-base.h (+5 lines)
 Lines 774-779   protected: Link Here 
774
  uint32_t m_timestampToEcho;     //!< Timestamp to echo
774
  uint32_t m_timestampToEcho;     //!< Timestamp to echo
775
775
776
  EventId m_sendPendingDataEvent; //!< micro-delay event to send pending data
776
  EventId m_sendPendingDataEvent; //!< micro-delay event to send pending data
777
778
  Time m_realRTO;   //!< Contains the exact time at when RTO should expire.
779
  bool m_isRealRTO; /**!< If true, indicates that m_retxEvent is the real RTO event.
780
                     *    Otherwise, m_realRTO applies. */
781
777
};
782
};
778
783
779
} // namespace ns3
784
} // namespace ns3

Return to bug 2220