catchunks: Improve CUBIC performance for lossy networks

Change-Id: I4baea5dcbc02d5c4a989330603e059daa55e767f
refs: #5036
diff --git a/tests/chunks/pipeline-interests-cubic.t.cpp b/tests/chunks/pipeline-interests-cubic.t.cpp
index 6cfa23e..51d5be2 100644
--- a/tests/chunks/pipeline-interests-cubic.t.cpp
+++ b/tests/chunks/pipeline-interests-cubic.t.cpp
@@ -83,12 +83,12 @@
 BOOST_AUTO_TEST_CASE(SlowStart)
 {
   nDataSegments = 4;
-  BOOST_REQUIRE_CLOSE(pipeline->m_cwnd, 1, MARGIN);
+  BOOST_REQUIRE_CLOSE(pipeline->m_cwnd, 2, MARGIN);
 
   double preCwnd = pipeline->m_cwnd;
   run(name);
   advanceClocks(io, time::nanoseconds(1));
-  BOOST_CHECK_EQUAL(face.sentInterests.size(), 1);
+  BOOST_CHECK_EQUAL(face.sentInterests.size(), 2);
 
   for (uint64_t i = 0; i < nDataSegments - 1; ++i) {
     face.receive(*makeDataWithSegment(i));
@@ -104,11 +104,11 @@
 BOOST_AUTO_TEST_CASE(Timeout)
 {
   nDataSegments = 8;
-  BOOST_REQUIRE_CLOSE(pipeline->m_cwnd, 1, MARGIN);
+  BOOST_REQUIRE_CLOSE(pipeline->m_cwnd, 2, MARGIN);
 
   run(name);
   advanceClocks(io, time::nanoseconds(1));
-  BOOST_CHECK_EQUAL(face.sentInterests.size(), 1);
+  BOOST_CHECK_EQUAL(face.sentInterests.size(), 2);
 
   // receive segment 0, 1, and 2
   for (uint64_t i = 0; i < 3; ++i) {
@@ -117,8 +117,8 @@
   }
 
   BOOST_CHECK_EQUAL(pipeline->m_nReceived, 3);
-  BOOST_CHECK_CLOSE(pipeline->m_cwnd, 4, MARGIN);
-  BOOST_CHECK_EQUAL(face.sentInterests.size(), 7); // request for segment 7 has been sent
+  BOOST_CHECK_CLOSE(pipeline->m_cwnd, 5, MARGIN);
+  BOOST_CHECK_EQUAL(face.sentInterests.size(), 8); // request for segment #7 has been sent
 
   advanceClocks(io, time::milliseconds(100));
 
@@ -131,7 +131,7 @@
   advanceClocks(io, time::nanoseconds(1));
 
   BOOST_CHECK_EQUAL(pipeline->m_nReceived, 5);
-  BOOST_CHECK_CLOSE(pipeline->m_cwnd, 6.0, MARGIN);
+  BOOST_CHECK_CLOSE(pipeline->m_cwnd, 7.0, MARGIN);
   BOOST_CHECK_EQUAL(face.sentInterests.size(), nDataSegments); // all the segment requests have been sent
 
   BOOST_CHECK_EQUAL(pipeline->m_nTimeouts, 0);
@@ -143,13 +143,13 @@
 
   // timeout segment 3 & 6
   advanceClocks(io, time::milliseconds(150));
-  BOOST_CHECK_EQUAL(pipeline->m_nTimeouts, 2);
-  BOOST_CHECK_EQUAL(pipeline->m_nRetransmitted, 2);
+  BOOST_CHECK_EQUAL(pipeline->m_nTimeouts, 3);
+  BOOST_CHECK_EQUAL(pipeline->m_nRetransmitted, 3);
   BOOST_CHECK_EQUAL(pipeline->m_nLossDecr, 1);
   BOOST_CHECK_EQUAL(pipeline->m_nSkippedRetx, 0);
 
   BOOST_CHECK_EQUAL(pipeline->m_nReceived, 5);
-  BOOST_CHECK_CLOSE(pipeline->m_cwnd, 4.2, MARGIN); // window size drop to 0.7x of previous size
+  BOOST_CHECK_CLOSE(pipeline->m_cwnd, 4.9, MARGIN); // window size drop to 0.7x of previous size
   BOOST_CHECK_EQUAL(pipeline->m_retxQueue.size(), 0);
 
   // receive segment 6, retransmit 3
@@ -157,12 +157,12 @@
   advanceClocks(io, time::nanoseconds(1));
 
   BOOST_CHECK_EQUAL(pipeline->m_nReceived, 6);
-  BOOST_CHECK_CLOSE(pipeline->m_cwnd, 4.2, MARGIN); // congestion avoidance
+  BOOST_CHECK_CLOSE(pipeline->m_cwnd, 4.9, MARGIN); // congestion avoidance
   BOOST_CHECK_EQUAL(pipeline->m_retxQueue.size(), 0);
   BOOST_CHECK_EQUAL(pipeline->m_retxCount[3], 1);
 
-  BOOST_CHECK_EQUAL(pipeline->m_nTimeouts, 2);
-  BOOST_CHECK_EQUAL(pipeline->m_nRetransmitted, 2);
+  BOOST_CHECK_EQUAL(pipeline->m_nTimeouts, 3);
+  BOOST_CHECK_EQUAL(pipeline->m_nRetransmitted, 3);
   BOOST_CHECK_EQUAL(pipeline->m_nTimeouts,
       pipeline->m_nRetransmitted + pipeline->m_nSkippedRetx);
 
@@ -171,11 +171,11 @@
 BOOST_AUTO_TEST_CASE(CongestionMarksWithCwa)
 {
   nDataSegments = 7;
-  BOOST_REQUIRE_CLOSE(pipeline->m_cwnd, 1, MARGIN);
+  BOOST_REQUIRE_CLOSE(pipeline->m_cwnd, 2, MARGIN);
 
   run(name);
   advanceClocks(io, time::nanoseconds(1));
-  BOOST_CHECK_EQUAL(face.sentInterests.size(), 1);
+  BOOST_CHECK_EQUAL(face.sentInterests.size(), 2);
 
   // receive segments 0 to 4
   for (uint64_t i = 0; i < 5; ++i) {
@@ -184,14 +184,14 @@
   }
 
   BOOST_CHECK_EQUAL(pipeline->m_nReceived, 5);
-  BOOST_CHECK_CLOSE(pipeline->m_cwnd, 6.0, MARGIN);
+  BOOST_CHECK_CLOSE(pipeline->m_cwnd, 7.0, MARGIN);
 
   // receive segment 5 with congestion mark
   face.receive(*makeDataWithSegmentAndCongMark(5));
   advanceClocks(io, time::nanoseconds(1));
 
   BOOST_CHECK_EQUAL(pipeline->m_nReceived, 6);
-  BOOST_CHECK_CLOSE(pipeline->m_cwnd, 4.2, MARGIN); // window size drops to 1/2 of previous size
+  BOOST_CHECK_CLOSE(pipeline->m_cwnd, 4.9, MARGIN); // window size drops to 0.7x of previous size
   BOOST_CHECK_EQUAL(face.sentInterests.size(), nDataSegments); // all interests have been sent
 
   // receive the last segment with congestion mark
@@ -199,7 +199,7 @@
   advanceClocks(io, time::nanoseconds(1));
 
   BOOST_CHECK_EQUAL(pipeline->m_nReceived, nDataSegments);
-  BOOST_CHECK_CLOSE(pipeline->m_cwnd, 4.2, MARGIN); // conservative window adaption (window size should not decrease)
+  BOOST_CHECK_CLOSE(pipeline->m_cwnd, 4.9, MARGIN); // conservative window adaption (window size should not decrease)
   BOOST_CHECK_EQUAL(pipeline->m_retxQueue.size(), 0);
 
   // make sure no interest is retransmitted for marked data packets
@@ -216,11 +216,11 @@
   createPipeline();
 
   nDataSegments = 7;
-  BOOST_REQUIRE_CLOSE(pipeline->m_cwnd, 1, MARGIN);
+  BOOST_REQUIRE_CLOSE(pipeline->m_cwnd, 2, MARGIN);
 
   run(name);
   advanceClocks(io, time::nanoseconds(1));
-  BOOST_CHECK_EQUAL(face.sentInterests.size(), 1);
+  BOOST_CHECK_EQUAL(face.sentInterests.size(), 2);
 
   // receive segments 0 to 4
   for (uint64_t i = 0; i < 5; ++i) {
@@ -229,14 +229,14 @@
   }
 
   BOOST_CHECK_EQUAL(pipeline->m_nReceived, 5);
-  BOOST_CHECK_CLOSE(pipeline->m_cwnd, 6.0, MARGIN);
+  BOOST_CHECK_CLOSE(pipeline->m_cwnd, 7.0, MARGIN);
 
   // receive segment 5 with congestion mark
   face.receive(*makeDataWithSegmentAndCongMark(5));
   advanceClocks(io, time::nanoseconds(1));
 
   BOOST_CHECK_EQUAL(pipeline->m_nReceived, 6);
-  BOOST_CHECK_CLOSE(pipeline->m_cwnd, 4.2, MARGIN); // window size drops to 1/2 of previous size
+  BOOST_CHECK_CLOSE(pipeline->m_cwnd, 4.9, MARGIN); // window size drops to 0.7x of previous size
   BOOST_CHECK_EQUAL(face.sentInterests.size(), nDataSegments); // all interests have been sent
 
   // receive the last segment with congestion mark
@@ -244,8 +244,7 @@
   advanceClocks(io, time::nanoseconds(1));
 
   BOOST_CHECK_EQUAL(pipeline->m_nReceived, nDataSegments);
-  BOOST_CHECK_CLOSE(pipeline->m_cwnd, 2.94,
-                    MARGIN); // window size should decrease, as cwa is disabled
+  BOOST_CHECK_CLOSE(pipeline->m_cwnd, 3.43, MARGIN); // window size should decrease, as cwa is disabled
   BOOST_CHECK_EQUAL(pipeline->m_retxQueue.size(), 0);
 
   // make sure no interest is retransmitted for marked data packets
@@ -262,11 +261,11 @@
   createPipeline();
 
   nDataSegments = 7;
-  BOOST_REQUIRE_CLOSE(pipeline->m_cwnd, 1, MARGIN);
+  BOOST_REQUIRE_CLOSE(pipeline->m_cwnd, 2, MARGIN);
 
   run(name);
   advanceClocks(io, time::nanoseconds(1));
-  BOOST_CHECK_EQUAL(face.sentInterests.size(), 1);
+  BOOST_CHECK_EQUAL(face.sentInterests.size(), 2);
 
   // receive segments 0 to 5
   for (uint64_t i = 0; i < 6; ++i) {
@@ -275,7 +274,7 @@
   }
 
   BOOST_CHECK_EQUAL(pipeline->m_nReceived, 6);
-  BOOST_CHECK_CLOSE(pipeline->m_cwnd, 7.0, MARGIN);
+  BOOST_CHECK_CLOSE(pipeline->m_cwnd, 8.0, MARGIN);
   BOOST_CHECK_EQUAL(face.sentInterests.size(), nDataSegments); // all interests have been sent
 
   // receive the last segment with congestion mark
@@ -283,7 +282,7 @@
   advanceClocks(io, time::nanoseconds(1));
 
   BOOST_CHECK_EQUAL(pipeline->m_nReceived, nDataSegments);
-  BOOST_CHECK_CLOSE(pipeline->m_cwnd, 8.0, MARGIN); // window size increases
+  BOOST_CHECK_CLOSE(pipeline->m_cwnd, 9.0, MARGIN); // window size increases
   BOOST_CHECK_EQUAL(pipeline->m_retxQueue.size(), 0);
 
   // make sure no interest is retransmitted for marked data packet