Track datagrams received out of order and missed datagrams.

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@6047 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Andrzej Kapolka
2010-03-18 20:36:25 +00:00
parent 5ecfff4bcb
commit bd6a35677a
3 changed files with 23 additions and 6 deletions
@@ -102,6 +102,7 @@ public class DatagramSequencer
if (number <= _lastReceived) {
return null;
}
_missedCount = number - _lastReceived - 1;
_lastReceived = number;
// read the acknowledge number and process all send records up to that one
@@ -132,6 +133,14 @@ public class DatagramSequencer
return datagram;
}
/**
* Returns the number of datagrams missed between the last and the one before it.
*/
public int getMissedCount ()
{
return _missedCount;
}
/**
* A record of a sent datagram.
*/
@@ -168,6 +177,9 @@ public class DatagramSequencer
/** The most recent sequence number received. */
protected int _lastReceived;
/** The number of datagrams missed between the last and the one before it. */
protected int _missedCount;
/** Records of datagrams sent. */
protected ArrayList<SendRecord> _sendrecs = Lists.newArrayList();
}