tcp: (merges !368) Fix assert in tx-buffer when loss rate high and w/o SACK

This commit is contained in:
Xiuchao Wu
2020-08-13 15:12:00 +01:00
committed by Tom Henderson
parent ee70f4502b
commit 41ff743383
3 changed files with 35 additions and 1 deletions

View File

@@ -1315,6 +1315,7 @@ TcpSocketBase::DoForwardUp (Ptr<Packet> packet, const Address &fromAddress,
else
{
m_sackEnabled = false;
m_txBuffer->SetSackEnabled (false);
}
// When receiving a <SYN> or <SYN-ACK> we should adapt TS to the other end

View File

@@ -112,6 +112,18 @@ TcpTxBuffer::SetMaxBufferSize (uint32_t n)
m_maxBuffer = n;
}
bool
TcpTxBuffer::IsSackEnabled (void) const
{
return m_sackEnabled;
}
void
TcpTxBuffer::SetSackEnabled (bool enabled)
{
m_sackEnabled = enabled;
}
uint32_t
TcpTxBuffer::Available (void) const
{
@@ -1379,7 +1391,15 @@ void
TcpTxBuffer::AddRenoSack (void)
{
NS_LOG_FUNCTION (this);
NS_ASSERT (m_sentList.size () > 1);
if (m_sackEnabled)
{
NS_ASSERT (m_sentList.size () > 1);
}
else
{
NS_ASSERT (m_sentList.size () > 0);
}
m_renoSack = true;

View File

@@ -166,6 +166,18 @@ public:
*/
void SetMaxBufferSize (uint32_t n);
/**
* \brief check whether SACK is used on the corresponding TCP socket
*/
bool IsSackEnabled (void) const;
/**
* \brief tell tx-buffer whether SACK is used on this TCP socket
*
* \param enabled whether sack is used
*/
void SetSackEnabled (bool enabled);
/**
* \brief Returns the available capacity of this buffer
* \returns available capacity in this Tx window
@@ -606,6 +618,7 @@ private:
uint32_t m_dupAckThresh {0}; //!< Duplicate Ack threshold from TcpSocketBase
uint32_t m_segmentSize {0}; //!< Segment size from TcpSocketBase
bool m_renoSack {false}; //!< Indicates if AddRenoSack was called
bool m_sackEnabled {true}; //!< Indicates if SACK is enabled on this connection
static Callback<void, TcpTxItem *> m_nullCb; //!< Null callback for an item
};