add some functions for estimation of number of bytes that can be send in a category in specified time

avinationmerge
UbitUmarov 2014-08-28 16:49:32 +01:00
parent ff4df688ba
commit 5a2d4fd47f
2 changed files with 13 additions and 0 deletions

View File

@ -453,6 +453,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP
return data;
}
public int GetCatBytesCanSend(ThrottleOutPacketType cat, int timeMS)
{
TokenBucket bucket = m_throttleCategories[(int)cat];
int bytes = timeMS * (int)(bucket.RequestedDripRate / 1000);
bytes += (int)bucket.CurrentTokenCount();
return bytes;
}
/// <summary>
/// Queue an outgoing packet if appropriate.

View File

@ -274,6 +274,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
return false;
}
public long CurrentTokenCount()
{
return m_tokenCount;
}
/// <summary>
/// Deposit tokens into the bucket from a child bucket that did
/// not use all of its available tokens