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

(-)i/src/internet/model/tcp-socket-base.cc (-8 / +13 lines)
 Lines 2204-2214   TcpSocketBase::SendEmptyPacket (uint8_t flags) Link Here 
2204
      header.SetDestinationPort (m_endPoint6->GetPeerPort ());
2204
      header.SetDestinationPort (m_endPoint6->GetPeerPort ());
2205
    }
2205
    }
2206
  AddOptions (header);
2206
  AddOptions (header);
2207
  header.SetWindowSize (AdvertisedWindowSize ());
2208
2207
2209
  // RFC 6298, clause 2.4
2208
  // RFC 6298, clause 2.4
2210
  m_rto = Max (m_rtt->GetEstimate () + Max (m_clockGranularity, m_rtt->GetVariation () * 4), m_minRto);
2209
  m_rto = Max (m_rtt->GetEstimate () + Max (m_clockGranularity, m_rtt->GetVariation () * 4), m_minRto);
2211
2210
2211
  uint16_t windowSize = AdvertisedWindowSize ();
2212
  bool hasSyn = flags & TcpHeader::SYN;
2212
  bool hasSyn = flags & TcpHeader::SYN;
2213
  bool hasFin = flags & TcpHeader::FIN;
2213
  bool hasFin = flags & TcpHeader::FIN;
2214
  bool isAck = flags == TcpHeader::ACK;
2214
  bool isAck = flags == TcpHeader::ACK;
 Lines 2241-2247   TcpSocketBase::SendEmptyPacket (uint8_t flags) Link Here 
2241
        { // This is SYN retransmission
2241
        { // This is SYN retransmission
2242
          UpdateRttHistory (s, 0, true);
2242
          UpdateRttHistory (s, 0, true);
2243
        }
2243
        }
2244
2245
      windowSize = AdvertisedWindowSize (false);
2244
    }
2246
    }
2247
  header.SetWindowSize (windowSize);
2245
2248
2246
  m_txTrace (p, header, this);
2249
  m_txTrace (p, header, this);
2247
2250
 Lines 2702-2719   TcpSocketBase::AvailableWindow () const Link Here 
2702
}
2705
}
2703
2706
2704
uint16_t
2707
uint16_t
2705
TcpSocketBase::AdvertisedWindowSize () const
2708
TcpSocketBase::AdvertisedWindowSize (bool scale) const
2706
{
2709
{
2707
  uint32_t w = m_rxBuffer->MaxBufferSize ();
2710
  uint32_t w = m_rxBuffer->MaxBufferSize ();
2708
2711
2709
  w >>= m_rcvWindShift;
2712
  if (scale)
2710
2711
  if (w > m_maxWinSize)
2712
    {
2713
    {
2713
      NS_LOG_WARN ("There is a loss in the adv win size, wrt buffer size");
2714
      w >>= m_rcvWindShift;
2714
      w = m_maxWinSize;
2715
2716
      if (w > m_maxWinSize)
2717
        {
2718
          NS_LOG_WARN ("There is a loss in the adv win size, wrt buffer size");
2719
          w = m_maxWinSize;
2720
        }
2715
    }
2721
    }
2716
2717
  return (uint16_t) w;
2722
  return (uint16_t) w;
2718
}
2723
}
2719
2724
(-)i/src/internet/model/tcp-socket-base.h (-1 / +3 lines)
 Lines 783-791   protected: Link Here 
783
783
784
  /**
784
  /**
785
   * \brief The amount of Rx window announced to the peer
785
   * \brief The amount of Rx window announced to the peer
786
   * \param scale indicate if the window should be scaled. True for
787
   * almost all cases, except when we are sending a SYN
786
   * \returns size of Rx window announced to the peer
788
   * \returns size of Rx window announced to the peer
787
   */
789
   */
788
  virtual uint16_t AdvertisedWindowSize (void) const;
790
  virtual uint16_t AdvertisedWindowSize (bool scale = true) const;
789
791
790
  /**
792
  /**
791
   * \brief Update the receiver window (RWND) based on the value of the
793
   * \brief Update the receiver window (RWND) based on the value of the

Return to bug 2392