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

(-)a/src/internet/model/tcp-socket-base.cc (-11 / +36 lines)
 Lines 1204-1209   TcpSocketBase::DoForwardUp (Ptr<Packet> packet, const Address &fromAddress, Link Here 
1204
      // Initialize cWnd and ssThresh
1204
      // Initialize cWnd and ssThresh
1205
      m_tcb->m_cWnd = GetInitialCwnd () * GetSegSize ();
1205
      m_tcb->m_cWnd = GetInitialCwnd () * GetSegSize ();
1206
      m_tcb->m_ssThresh = GetInitialSSThresh ();
1206
      m_tcb->m_ssThresh = GetInitialSSThresh ();
1207
1208
      if (tcpHeader.GetFlags() & TcpHeader::ACK)
1209
        {
1210
          EstimateRtt (tcpHeader);
1211
          m_highRxAckMark = tcpHeader.GetAckNumber ();
1212
        }
1207
    }
1213
    }
1208
  else if (tcpHeader.GetFlags () & TcpHeader::ACK)
1214
  else if (tcpHeader.GetFlags () & TcpHeader::ACK)
1209
    {
1215
    {
 Lines 2160-2165   TcpSocketBase::SendEmptyPacket (uint8_t flags) Link Here 
2160
          m_rto = m_cnTimeout * backoffCount;
2166
          m_rto = m_cnTimeout * backoffCount;
2161
          m_synCount--;
2167
          m_synCount--;
2162
        }
2168
        }
2169
2170
      if (m_synRetries-1 == m_synCount)
2171
        {
2172
          UpdateRttHistory (s, 0, false);
2173
        }
2174
      else
2175
        { // This is SYN retransmission
2176
          UpdateRttHistory (s, 0, true);
2177
        }
2163
    }
2178
    }
2164
2179
2165
  m_txTrace (p, header, this);
2180
  m_txTrace (p, header, this);
 Lines 2346-2352   TcpSocketBase::SendDataPacket (SequenceNumber32 seq, uint32_t maxSize, bool with Link Here 
2346
  NS_LOG_FUNCTION (this << seq << maxSize << withAck);
2361
  NS_LOG_FUNCTION (this << seq << maxSize << withAck);
2347
2362
2348
  bool isRetransmission = false;
2363
  bool isRetransmission = false;
2349
  if ( seq == m_txBuffer->HeadSequence () )
2364
  if (seq == m_txBuffer->HeadSequence ()
2365
      && m_txBuffer->HeadSequence () != m_highRxAckMark)
2350
    {
2366
    {
2351
      isRetransmission = true;
2367
      isRetransmission = true;
2352
    }
2368
    }
 Lines 2463-2472   TcpSocketBase::SendDataPacket (SequenceNumber32 seq, uint32_t maxSize, bool with Link Here 
2463
                    ". Header " << header);
2479
                    ". Header " << header);
2464
    }
2480
    }
2465
2481
2482
  UpdateRttHistory (seq, sz, isRetransmission);
2483
2484
  // Notify the application of the data being sent unless this is a retransmit
2485
  if (seq + sz > m_highTxMark)
2486
    {
2487
      Simulator::ScheduleNow (&TcpSocketBase::NotifyDataSent, this, (seq + sz - m_highTxMark.Get ()));
2488
    }
2489
  // Update highTxMark
2490
  m_highTxMark = std::max (seq + sz, m_highTxMark.Get ());
2491
  return sz;
2492
}
2493
2494
void
2495
TcpSocketBase::UpdateRttHistory (const SequenceNumber32 &seq, uint32_t sz,
2496
                                 bool isRetransmission)
2497
{
2498
  NS_LOG_FUNCTION (this);
2499
2466
  // update the history of sequence numbers used to calculate the RTT
2500
  // update the history of sequence numbers used to calculate the RTT
2467
  if (isRetransmission == false)
2501
  if (isRetransmission == false)
2468
    { // This is the next expected one, just log at end
2502
    { // This is the next expected one, just log at end
2469
      m_history.push_back (RttHistory (seq, sz, Simulator::Now () ));
2503
      m_history.push_back (RttHistory (seq, sz, Simulator::Now ()));
2470
    }
2504
    }
2471
  else
2505
  else
2472
    { // This is a retransmit, find in list and mark as re-tx
2506
    { // This is a retransmit, find in list and mark as re-tx
 Lines 2480-2494   TcpSocketBase::SendDataPacket (SequenceNumber32 seq, uint32_t maxSize, bool with Link Here 
2480
            }
2514
            }
2481
        }
2515
        }
2482
    }
2516
    }
2483
2484
  // Notify the application of the data being sent unless this is a retransmit
2485
  if (seq + sz > m_highTxMark)
2486
    {
2487
      Simulator::ScheduleNow (&TcpSocketBase::NotifyDataSent, this, (seq + sz - m_highTxMark.Get ()));
2488
    }
2489
  // Update highTxMark
2490
  m_highTxMark = std::max (seq + sz, m_highTxMark.Get ());
2491
  return sz;
2492
}
2517
}
2493
2518
2494
/* Send as much pending data as possible according to the Tx window. Note that
2519
/* Send as much pending data as possible according to the Tx window. Note that
(-)a/src/internet/model/tcp-socket-base.h (+11 lines)
 Lines 788-793   protected: Link Here 
788
  virtual void EstimateRtt (const TcpHeader& tcpHeader);
788
  virtual void EstimateRtt (const TcpHeader& tcpHeader);
789
789
790
  /**
790
  /**
791
   * \brief Update the RTT history, when we send TCP segments
792
   *
793
   * \param seq The sequence number of the TCP segment
794
   * \param sz The segment's size
795
   * \param isRetransmission Whether or not the segment is a retransmission
796
   */
797
798
  virtual void UpdateRttHistory (const SequenceNumber32 &seq, uint32_t sz,
799
                                 bool isRetransmission);
800
801
  /**
791
   * \brief Update buffers w.r.t. ACK
802
   * \brief Update buffers w.r.t. ACK
792
   * \param seq the sequence number
803
   * \param seq the sequence number
793
   * \param resetRTO indicates if RTO should be reset
804
   * \param resetRTO indicates if RTO should be reset

Return to bug 2302