fixed bug in SequenceNumberStats and its unit test; test passes now

This commit is contained in:
wangyix 2014-07-03 10:37:09 -07:00
parent ab503583dd
commit 059628c26a
2 changed files with 14 additions and 2 deletions

View file

@ -94,6 +94,7 @@ void SequenceNumberStats::sequenceNumberReceived(quint16 incoming, QUuid senderU
_numEarly++;
_numLost += (incomingInt - expectedInt);
_lastReceived = incoming;
// add all sequence numbers that were skipped to the missing sequence numbers list
for (int missingInt = expectedInt; missingInt < incomingInt; missingInt++) {
@ -105,8 +106,6 @@ void SequenceNumberStats::sequenceNumberReceived(quint16 incoming, QUuid senderU
if (_missingSet.size() > MAX_REASONABLE_SEQUENCE_GAP) {
pruneMissingSet(wantExtraDebugging);
}
_lastReceived = incoming;
} else { // late
if (wantExtraDebugging) {
qDebug() << "this packet is later than expected...";

View file

@ -115,6 +115,11 @@ void SequenceNumberStatsTests::earlyLateTest() {
}
}
stats.reset();
numSent = 0;
numEarly = 0;
numLate = 0;
numLost = 0;
numRecovered = 0;
}
}
@ -203,6 +208,11 @@ void SequenceNumberStatsTests::duplicateTest() {
}
}
stats.reset();
numSent = 0;
numDuplicate = 0;
numEarly = 0;
numLate = 0;
numLost = 0;
}
}
@ -263,5 +273,8 @@ void SequenceNumberStatsTests::pruneTest() {
}
}
stats.reset();
numSent = 0;
numEarly = 0;
numLost = 0;
}
}