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

(-)i/src/internet/model/tcp-socket-base.cc (-7 / +17 lines)
 Lines 1536-1553   TcpSocketBase::ReceivedAck (Ptr<Packet> packet, const TcpHeader& tcpHeader) Link Here 
1536
               * fast recovery procedure (i.e., if any duplicate ACKs subsequently
1536
               * fast recovery procedure (i.e., if any duplicate ACKs subsequently
1537
               * arrive, execute step 4 of Section 3.2 of [RFC5681]).
1537
               * arrive, execute step 4 of Section 3.2 of [RFC5681]).
1538
                */
1538
                */
1539
              m_tcb->m_cWnd = SafeSubtraction (m_tcb->m_cWnd, bytesAcked);
1540
1539
              if (segsAcked >= 1)
1541
              if (segsAcked >= 1)
1540
                {
1542
                {
1541
                  m_tcb->m_cWnd += m_tcb->m_segmentSize - bytesAcked;
1543
                  m_tcb->m_cWnd += m_tcb->m_segmentSize;
1542
                }
1543
              else
1544
                {
1545
                  m_tcb->m_cWnd -= bytesAcked;
1546
                }
1544
                }
1547
1545
1548
              callCongestionControl = false; // No congestion control on cWnd show be invoked
1546
              callCongestionControl = false; // No congestion control on cWnd show be invoked
1549
              m_dupAckCount -= segsAcked;    // Update the dupAckCount
1547
              m_dupAckCount = SafeSubtraction (m_dupAckCount, segsAcked); // Update the dupAckCount
1550
              m_retransOut--;  // at least one retransmission has reached the other side
1548
              m_retransOut  = SafeSubtraction (m_retransOut, 1);  // at least one retransmission
1549
                                                                  // has reached the other side
1551
              m_txBuffer->DiscardUpTo (ackNumber);  //Bug 1850:  retransmit before newack
1550
              m_txBuffer->DiscardUpTo (ackNumber);  //Bug 1850:  retransmit before newack
1552
              DoRetransmit (); // Assume the next seq is lost. Retransmit lost packet
1551
              DoRetransmit (); // Assume the next seq is lost. Retransmit lost packet
1553
1552
 Lines 3389-3394   TcpSocketBase::Fork (void) Link Here 
3389
  return CopyObject<TcpSocketBase> (this);
3388
  return CopyObject<TcpSocketBase> (this);
3390
}
3389
}
3391
3390
3391
uint32_t
3392
TcpSocketBase::SafeSubtraction (uint32_t a, uint32_t b)
3393
{
3394
  if (a > b)
3395
    {
3396
      return a-b;
3397
    }
3398
3399
  return 0;
3400
}
3401
3392
//RttHistory methods
3402
//RttHistory methods
3393
RttHistory::RttHistory (SequenceNumber32 s, uint32_t c, Time t)
3403
RttHistory::RttHistory (SequenceNumber32 s, uint32_t c, Time t)
3394
  : seq (s),
3404
  : seq (s),
(-)i/src/internet/model/tcp-socket-base.h (+11 lines)
 Lines 883-888   protected: Link Here 
883
   */
883
   */
884
  void AddOptionTimestamp (TcpHeader& header);
884
  void AddOptionTimestamp (TcpHeader& header);
885
885
886
  /**
887
   * \brief Performs a safe subtraction between a and b (a-b)
888
   *
889
   * Safe is used to indicate that, if b>a, the results returned is 0.
890
   *
891
   * \param a first number
892
   * \param b second number
893
   * \return 0 if b>0, (a-b) otherwise
894
   */
895
  static uint32_t SafeSubtraction (uint32_t a, uint32_t b);
896
886
protected:
897
protected:
887
  // Counters and events
898
  // Counters and events
888
  EventId           m_retxEvent;       //!< Retransmission event
899
  EventId           m_retxEvent;       //!< Retransmission event

Return to bug 1783