[Sumover-dev] [svn commit] r4504 - vic/branches/cc/cc

sumover-dev at cs.ucl.ac.uk sumover-dev at cs.ucl.ac.uk
Wed Aug 5 14:26:57 BST 2009


Author: soohyunc
Date: Wed Aug  5 14:26:56 2009
New Revision: 4504

Modified:
   vic/branches/cc/cc/tfwc_sndr.cpp

Log:
(bug fix)
the sender wasn't able to detect/capture the packet sequence number of the very 
first lost packet properly. The first lost packet sequence number is important
when calculating the initial Average Loss History value.


Modified: vic/branches/cc/cc/tfwc_sndr.cpp
==============================================================================
--- vic/branches/cc/cc/tfwc_sndr.cpp	(original)
+++ vic/branches/cc/cc/tfwc_sndr.cpp	Wed Aug  5 14:26:56 2009
@@ -242,12 +242,12 @@
  */
 bool TfwcSndr::detect_loss(int end, int begin) {
 	bool ret;	// 'true' when there is a loss
-	int lc = 0;	// loss counter
+	bool gotIn = false;
+	int count = 0; // packet loss counter
 
 	// number of tempvec element when no loss
 	int numelm = (end - begin < 0) ? 0 : end - begin;
 	u_int32_t tempvec[numelm];
-	bool is_there = false;
 
 	// generate tempvec elements
 	printf("\tcomparing numbers: (");
@@ -257,30 +257,33 @@
 	} printf(" )\n");
 
 	// number of seqvec element
-	int numseq = ends_ - begins_;
+	int numseq = ends_ - begins_ - num_loss_;
 
 	// compare tempvec and seqvec
 	for (int i = 0; i < numelm; i++) {
-		for (int j = 0; j < numseq; j++) {
+		for (int j = numseq-1; j >= 0; j--) {
 			if (tempvec[i] == seqvec_[j]) {
-				is_there = true;
-				break;
+				gotIn = true;
+				// we found it, so reset count
+				count = 0; break;
+			} else {
+				gotIn = false; 
+				count++;
 			}
-		}
+		} // packet loss should be captured by now
 
-		// packet loss should be captured by now
-		if(!is_there) {
+		// record the very first lost packet seqno
+		if(!gotIn) {
 			if(!is_first_loss_seen_) 
 				first_lost_pkt_ = tempvec[i];
-			lc++;
 		}
 	}
 	
-	// store elements
+	// store tempvec elements for updating loss history
 	first_elm_ = tempvec[0];
 	last_elm_ = first_elm_ + (numelm - 1);
 
-	return ret = (lc > 0) ? true : false;
+	return ret = (count > 0) ? true : false;
 }
 
 /*



More information about the Sumover-dev mailing list