From 9d815d019d9e313d7569e6d397d9e659fd597090 Mon Sep 17 00:00:00 2001 From: Unknown Date: Tue, 22 Apr 2014 13:58:22 -0400 Subject: [PATCH] Bug 1850 --- src/internet/model/tcp-newreno.cc | 3 ++- src/test/ns3tcp/ns3tcp-cwnd-test-suite.cc | 30 ++++++++++------------- 2 files changed, 15 insertions(+), 18 deletions(-) diff --git a/src/internet/model/tcp-newreno.cc b/src/internet/model/tcp-newreno.cc index 417862718..5fa5f4580 100644 --- a/src/internet/model/tcp-newreno.cc +++ b/src/internet/model/tcp-newreno.cc @@ -127,8 +127,9 @@ TcpNewReno::NewAck (const SequenceNumber32& seq) m_cWnd -= seq - m_txBuffer.HeadSequence (); m_cWnd += m_segmentSize; // increase cwnd NS_LOG_INFO ("Partial ACK in fast recovery: cwnd set to " << m_cWnd); - TcpSocketBase::NewAck (seq); // update m_nextTxSequence and send new data if allowed by window + m_txBuffer.DiscardUpTo(seq); //Bug 1850: retransmit before newack DoRetransmit (); // Assume the next seq is lost. Retransmit lost packet + TcpSocketBase::NewAck (seq); // update m_nextTxSequence and send new data if allowed by window return; } else if (m_inFastRec && seq >= m_recover) diff --git a/src/test/ns3tcp/ns3tcp-cwnd-test-suite.cc b/src/test/ns3tcp/ns3tcp-cwnd-test-suite.cc index cad52e65d..4f9090c4b 100644 --- a/src/test/ns3tcp/ns3tcp-cwnd-test-suite.cc +++ b/src/test/ns3tcp/ns3tcp-cwnd-test-suite.cc @@ -485,7 +485,7 @@ Ns3TcpCwndTestCase2::DoRun (void) app->Setup (ns3TcpSocket, sinkAddress, 1040, 1000, DataRate ("1Mbps")); n0n1.Get (0)->AddApplication (app); app->SetStartTime (Seconds (1.0)); - app->SetStopTime (Seconds (4.4)); + app->SetStopTime (Seconds (4.1)); if (m_writeResults) { @@ -495,7 +495,7 @@ Ns3TcpCwndTestCase2::DoRun (void) } // Finally, set up the simulator to run. - Simulator::Stop (Seconds (4.4)); + Simulator::Stop (Seconds (4.1)); Simulator::Run (); Simulator::Destroy (); @@ -516,7 +516,7 @@ Ns3TcpCwndTestCase2::DoRun (void) const uint32_t MSS = 536; - const uint32_t N_EVENTS = 45; + const uint32_t N_EVENTS = 41; CwndEvent event; @@ -532,38 +532,34 @@ Ns3TcpCwndTestCase2::DoRun (void) VerifyCwndRun (11, 13, 9 * MSS, MSS); //Partial ack will end up modifying cwnd 2X due to how code is written - //Partial ACK in fast recovery: cwnd set to 4824 NS_TEST_ASSERT_MSG_EQ (m_responses.Get (15).m_newCwnd, 9 * MSS, "Wrong new cwnd value in cwnd change event " << 15); //DUP ACKS in fast recovery VerifyCwndRun (16, 17, 10 * MSS, MSS); //Partial ack will end up modifying cwnd 2X due to how code is written, therefore eat 18 and 19 - //Partial ACK in fast recovery: cwnd set to 4824 - NS_TEST_ASSERT_MSG_EQ (m_responses.Get (19).m_newCwnd, 9 * MSS, "Wrong new cwnd value in cwnd change event " << 19); - - //DUP ACKS in fast recovery - VerifyCwndRun (20, 22, 10 * MSS, MSS); + VerifyCwndRun (19, 20, 9 * MSS, MSS); - //Partial ack will end up modifying cwnd 2X due to how code is written, therefore eat 23, 24 - //Partial ACK in fast recovery: cwnd set to 4824 - NS_TEST_ASSERT_MSG_EQ (m_responses.Get (24).m_newCwnd, 10 * MSS, "Wrong new cwnd value in cwnd change event " << 24); - - //DUP ACKS in fast recovery - VerifyCwndRun (25, 29, 11 * MSS, MSS); + VerifyCwndRun(22, 25, 8 * MSS, MSS); + //Leaving fast recovery - NS_TEST_ASSERT_MSG_EQ (m_responses.Get (29).m_newCwnd, 5 * MSS, "Wrong new cwnd value in cwnd change event " << 29); + NS_TEST_ASSERT_MSG_EQ (m_responses.Get (26).m_newCwnd, 5 * MSS, "Wrong new cwnd value in cwnd change event " << 26); uint32_t cwnd = 5 * MSS; //In CongAvoid each event will increase cwnd by (MSS * MSS / cwnd) - for (uint32_t i = 30; i < N_EVENTS; ++i) + for (uint32_t i = 27; i < N_EVENTS; ++i) { double adder = static_cast (MSS * MSS) / cwnd; adder = std::max (1.0, adder); cwnd += static_cast (adder); NS_TEST_ASSERT_MSG_EQ (m_responses.Get (i).m_newCwnd, cwnd, "Wrong new cwnd value in cwnd change event " << i); } + + for (uint32_t i = 0; i < N_EVENTS; ++i) + { + std::cout << "i: " << m_responses.Get(i).m_newCwnd << " " << m_responses.Get(i).m_oldCwnd << std::endl; + } } void