summaryrefslogtreecommitdiff
path: root/indra/llmessage/llcircuit.cpp
diff options
context:
space:
mode:
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;
}