mirror of
https://github.com/opensim/opensim.git
synced 2026-07-31 22:05:36 +08:00
* eliminated some warnings and added some const and readonlies
* refactored some member names for readability and ccc (code convention conformance) * took away two refs from Rest.Inventory since * System.IO is part of System * System.Xml.Serialization is part of System.Xml
This commit is contained in:
@@ -40,7 +40,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
//private static readonly log4net.ILog m_log
|
||||
// = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private LLClientStackNetworkHandler m_networkHandler;
|
||||
private readonly LLClientStackNetworkHandler m_networkHandler;
|
||||
private IScene m_scene;
|
||||
|
||||
//private readonly ClientManager m_clientManager = new ClientManager();
|
||||
|
||||
@@ -29,63 +29,63 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
{
|
||||
public class LLPacketThrottle
|
||||
{
|
||||
private int max; // max allowable throttle
|
||||
private int min; // min allowable throttle
|
||||
private int throttle; // current throttle setting
|
||||
private static int divisor = 7; // the throttle time divisor, this probably should factor out
|
||||
private int sent; // current number of bytes sent
|
||||
private readonly int m_maxAllowableThrottle;
|
||||
private readonly int m_minAllowableThrottle;
|
||||
private int m_currentThrottle;
|
||||
private const int m_throttleTimeDivisor = 7;
|
||||
private int m_currentBytesSent;
|
||||
|
||||
public LLPacketThrottle(int Min, int Max, int Throttle)
|
||||
{
|
||||
max = Max;
|
||||
min = Min;
|
||||
throttle = Throttle;
|
||||
sent = 0;
|
||||
m_maxAllowableThrottle = Max;
|
||||
m_minAllowableThrottle = Min;
|
||||
m_currentThrottle = Throttle;
|
||||
m_currentBytesSent = 0;
|
||||
}
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
sent = 0;
|
||||
m_currentBytesSent = 0;
|
||||
}
|
||||
|
||||
public bool UnderLimit()
|
||||
{
|
||||
return (sent < (throttle/divisor));
|
||||
return (m_currentBytesSent < (m_currentThrottle/m_throttleTimeDivisor));
|
||||
}
|
||||
|
||||
public int Add(int bytes)
|
||||
{
|
||||
sent += bytes;
|
||||
return sent;
|
||||
m_currentBytesSent += bytes;
|
||||
return m_currentBytesSent;
|
||||
}
|
||||
|
||||
// Properties
|
||||
public int Max
|
||||
{
|
||||
get { return max; }
|
||||
get { return m_maxAllowableThrottle; }
|
||||
}
|
||||
|
||||
public int Min
|
||||
{
|
||||
get { return min; }
|
||||
get { return m_minAllowableThrottle; }
|
||||
}
|
||||
|
||||
public int Throttle
|
||||
{
|
||||
get { return throttle; }
|
||||
get { return m_currentThrottle; }
|
||||
set
|
||||
{
|
||||
if (value > max)
|
||||
if (value > m_maxAllowableThrottle)
|
||||
{
|
||||
throttle = max;
|
||||
m_currentThrottle = m_maxAllowableThrottle;
|
||||
}
|
||||
else if (value < min)
|
||||
else if (value < m_minAllowableThrottle)
|
||||
{
|
||||
throttle = min;
|
||||
m_currentThrottle = m_minAllowableThrottle;
|
||||
}
|
||||
else
|
||||
{
|
||||
throttle = value;
|
||||
m_currentThrottle = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user