summaryrefslogtreecommitdiff
path: root/indra/llmessage/llcircuit.cpp
diff options
context:
space:
mode:
authorChristian Goetze <cg@lindenlab.com>2008-10-01 00:42:47 +0000
committerChristian Goetze <cg@lindenlab.com>2008-10-01 00:42:47 +0000
commitb069bb9e71d31495f3f1312529d19fdb83c1779e (patch)
treecf7575a0025224c1f9b93a47a9879d9b280a5299 /indra/llmessage/llcircuit.cpp
parentd725e5b24075b2171f8a5b263969991e9b475078 (diff)
svn merge -r96886:98039 svn+ssh://svn.lindenlab.com/svn/linden/branches/Branch_1-24-Server --> release
Diffstat (limited to 'indra/llmessage/llcircuit.cpp')
-rw-r--r--indra/llmessage/llcircuit.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/indra/llmessage/llcircuit.cpp b/indra/llmessage/llcircuit.cpp
index 431fe802f6..9ad84d8242 100644
--- a/indra/llmessage/llcircuit.cpp
+++ b/indra/llmessage/llcircuit.cpp
@@ -60,6 +60,7 @@
#include "llrand.h"
#include "llstl.h"
#include "lltransfermanager.h"
+#include "llmodularmath.h"
const F32 PING_INTERVAL = 5.f; // seconds
const S32 PING_START_BLOCK = 3; // How many pings behind we have to be to consider ourself blocked.
@@ -676,6 +677,8 @@ void LLCircuitData::checkPacketInID(TPACKETID id, BOOL receive_resent)
mPacketsIn++;
setPacketInID((id + 1) % LL_MAX_OUT_PACKET_ID);
+ mLastPacketGap = 0;
+ mOutOfOrderRate.count(0);
return;
}
@@ -683,6 +686,7 @@ void LLCircuitData::checkPacketInID(TPACKETID id, BOOL receive_resent)
// now, check to see if we've got a gap
+ U32 gap = 0;
if ((mPacketsInID == id))
{
// nope! bump and wrap the counter, then return
@@ -704,6 +708,11 @@ void LLCircuitData::checkPacketInID(TPACKETID id, BOOL receive_resent)
// otherwise, walk from mCurrentCircuit->mPacketsInID to id with wrapping, adding the values to the map
// and setting mPacketsInID to id + 1 % LL_MAX_OUT_PACKET_ID
+ // babbage: all operands in expression are unsigned, so modular
+ // arithmetic will always find correct gap, regardless of wrap arounds.
+ const U8 width = 24;
+ gap = LLModularMath::subtract<width>(mPacketsInID, id);
+
if (mPotentialLostPackets.find(id) != mPotentialLostPackets.end())
{
if(gMessageSystem->mVerboseLog)
@@ -765,6 +774,8 @@ void LLCircuitData::checkPacketInID(TPACKETID id, BOOL receive_resent)
}
}
+ mOutOfOrderRate.count(gap);
+ mLastPacketGap = gap;
}