--- a/src/internet/model/tcp-newreno.cc Tue Apr 22 11:52:55 2014 -0400
+++ b/src/internet/model/tcp-newreno.cc Tue Apr 22 13:58:22 2014 -0400
@@ -127,8 +127,9 @@
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);
+ 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
- DoRetransmit (); // Assume the next seq is lost. Retransmit lost packet
return;
}
else if (m_inFastRec && seq >= m_recover)
--- a/src/test/ns3tcp/ns3tcp-cwnd-test-suite.cc Tue Apr 22 11:52:55 2014 -0400
+++ b/src/test/ns3tcp/ns3tcp-cwnd-test-suite.cc Tue Apr 22 13:58:22 2014 -0400
@@ -485,7 +485,7 @@
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 @@
}
// 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 @@
const uint32_t MSS = 536;
- const uint32_t N_EVENTS = 45;
+ const uint32_t N_EVENTS = 41;
CwndEvent event;
@@ -532,38 +532,34 @@
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<double> (MSS * MSS) / cwnd;
adder = std::max (1.0, adder);
cwnd += static_cast<uint32_t> (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