Commit 8e92fc79 authored by Pramod R Sanaga's avatar Pramod R Sanaga
Browse files

Fixed an array overflow in throughput calculation.

parent 1bd55e88
......@@ -150,7 +150,7 @@ void UdpAvgThroughputSensor::localAck(char *packetData, int Len,int overheadLen,
tmpUdpAck.timeTaken = ackTimeDiff - timeDiff;
ackList[queuePtr] = tmpUdpAck;
queuePtr = queuePtr + 1;
queuePtr = (queuePtr + 1)%100;
minSamples++;
if(minSamples < 100)
......@@ -176,7 +176,7 @@ void UdpAvgThroughputSensor::calculateTput(unsigned long long timeStamp)
for(i = 0;(i < sampleCount&& timePeriod < 500000); i++)
{
index = (queuePtr - i + 100)%100;
index = (queuePtr -1 - i + 100)%100;
timePeriod += ackList[index].timeTaken;
packetSizeSum += ackList[index].packetSize;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment