mirror of
https://github.com/opensim/opensim.git
synced 2026-08-07 09:45:47 +08:00
* Put in some infrastructure to allow tweaking of packet queue throttle values for the total throttle (the one that throttles all packet output)
* Not complete yet
This commit is contained in:
@@ -219,12 +219,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
|
||||
// Constructors
|
||||
//
|
||||
public LLPacketHandler(IClientAPI client, LLPacketServer server)
|
||||
public LLPacketHandler(IClientAPI client, LLPacketServer server, ClientStackUserSettings userSettings)
|
||||
{
|
||||
m_Client = client;
|
||||
m_PacketServer = server;
|
||||
|
||||
m_PacketQueue = new LLPacketQueue(client.AgentId);
|
||||
m_PacketQueue = new LLPacketQueue(client.AgentId, userSettings);
|
||||
|
||||
m_AckTimer.Elapsed += AckTimerElapsed;
|
||||
m_AckTimer.Start();
|
||||
|
||||
@@ -34,6 +34,7 @@ using OpenMetaverse.Packets;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Statistics;
|
||||
using OpenSim.Framework.Statistics.Interfaces;
|
||||
using OpenSim.Region.ClientStack;
|
||||
using Timer=System.Timers.Timer;
|
||||
|
||||
|
||||
@@ -45,7 +46,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
= log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
/// <summary>
|
||||
/// Is throttling enabled at all?
|
||||
/// Is queueing enabled at all?
|
||||
/// </summary>
|
||||
private bool m_enabled = true;
|
||||
|
||||
@@ -88,7 +89,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
|
||||
private UUID m_agentId;
|
||||
|
||||
public LLPacketQueue(UUID agentId)
|
||||
public LLPacketQueue(UUID agentId, ClientStackUserSettings userSettings)
|
||||
{
|
||||
// While working on this, the BlockingQueue had me fooled for a bit.
|
||||
// The Blocking queue causes the thread to stop until there's something
|
||||
@@ -108,7 +109,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
TextureOutgoingPacketQueue = new Queue<LLQueItem>();
|
||||
AssetOutgoingPacketQueue = new Queue<LLQueItem>();
|
||||
|
||||
|
||||
// Set up the throttle classes (min, max, current) in bytes
|
||||
ResendThrottle = new LLPacketThrottle(5000, 100000, 16000);
|
||||
LandThrottle = new LLPacketThrottle(1000, 100000, 2000);
|
||||
@@ -117,9 +117,18 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
TaskThrottle = new LLPacketThrottle(1000, 800000, 3000);
|
||||
AssetThrottle = new LLPacketThrottle(1000, 800000, 1000);
|
||||
TextureThrottle = new LLPacketThrottle(1000, 800000, 4000);
|
||||
|
||||
// Total Throttle trumps all
|
||||
// Number of bytes allowed to go out per second. (256kbps per client)
|
||||
TotalThrottle = new LLPacketThrottle(0, 1500000, 28000);
|
||||
// Number of bytes allowed to go out per second.
|
||||
ThrottleSettings totalThrottleSettings = userSettings.TotalThrottleSettings;
|
||||
if (null == totalThrottleSettings)
|
||||
{
|
||||
totalThrottleSettings = new ThrottleSettings(0, 1500000, 28000);
|
||||
}
|
||||
|
||||
TotalThrottle
|
||||
= new LLPacketThrottle(
|
||||
totalThrottleSettings.Min, totalThrottleSettings.Max, totalThrottleSettings.Current);
|
||||
|
||||
throttleTimer = new Timer((int) (throttletimems/throttleTimeDivisor));
|
||||
throttleTimer.Elapsed += new ElapsedEventHandler(ThrottleTimerElapsed);
|
||||
|
||||
@@ -47,10 +47,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
//{
|
||||
// get { return m_clientManager; }
|
||||
//}
|
||||
|
||||
/// <summary>
|
||||
/// Tweakable user settings
|
||||
/// </summary>
|
||||
private ClientStackUserSettings m_userSettings;
|
||||
|
||||
public LLPacketServer(ILLClientStackNetworkHandler networkHandler)
|
||||
public LLPacketServer(ILLClientStackNetworkHandler networkHandler, ClientStackUserSettings userSettings)
|
||||
{
|
||||
m_userSettings = userSettings;
|
||||
m_networkHandler = networkHandler;
|
||||
|
||||
m_networkHandler.RegisterPacketServer(this);
|
||||
}
|
||||
|
||||
@@ -90,7 +97,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
UUID agentId, UUID sessionId, uint circuitCode, EndPoint proxyEP)
|
||||
{
|
||||
return
|
||||
new LLClientView(remoteEP, scene, assetCache, packServer, authenSessions, agentId, sessionId, circuitCode, proxyEP);
|
||||
new LLClientView(
|
||||
remoteEP, scene, assetCache, packServer, authenSessions, agentId, sessionId, circuitCode, proxyEP,
|
||||
m_userSettings);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -130,9 +130,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
{
|
||||
}
|
||||
|
||||
public LLUDPServer(IPAddress _listenIP, ref uint port, int proxyPortOffset, bool allow_alternate_port, AssetCache assetCache, AgentCircuitManager authenticateClass)
|
||||
public LLUDPServer(
|
||||
IPAddress _listenIP, ref uint port, int proxyPortOffset, bool allow_alternate_port, ClientStackUserSettings userSettings,
|
||||
AssetCache assetCache, AgentCircuitManager authenticateClass)
|
||||
{
|
||||
Initialise(_listenIP, ref port, proxyPortOffset, allow_alternate_port, assetCache, authenticateClass);
|
||||
Initialise(_listenIP, ref port, proxyPortOffset, allow_alternate_port, userSettings, assetCache, authenticateClass);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -142,10 +144,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
/// <param name="port"></param>
|
||||
/// <param name="proxyPortOffsetParm"></param>
|
||||
/// <param name="allow_alternate_port"></param>
|
||||
/// <param name="settings"></param>
|
||||
/// <param name="assetCache"></param>
|
||||
/// <param name="circuitManager"></param>
|
||||
public void Initialise(
|
||||
IPAddress _listenIP, ref uint port, int proxyPortOffsetParm, bool allow_alternate_port, AssetCache assetCache, AgentCircuitManager circuitManager)
|
||||
IPAddress _listenIP, ref uint port, int proxyPortOffsetParm, bool allow_alternate_port, ClientStackUserSettings userSettings,
|
||||
AssetCache assetCache, AgentCircuitManager circuitManager)
|
||||
{
|
||||
proxyPortOffset = proxyPortOffsetParm;
|
||||
listenPort = (uint) (port + proxyPortOffsetParm);
|
||||
@@ -153,7 +157,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
Allow_Alternate_Port = allow_alternate_port;
|
||||
m_assetCache = assetCache;
|
||||
m_circuitManager = circuitManager;
|
||||
CreatePacketServer();
|
||||
CreatePacketServer(userSettings);
|
||||
|
||||
// Return new port
|
||||
// This because in Grid mode it is not really important what port the region listens to as long as it is correctly registered.
|
||||
@@ -161,9 +165,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
port = (uint)(listenPort - proxyPortOffsetParm);
|
||||
}
|
||||
|
||||
protected virtual void CreatePacketServer()
|
||||
protected virtual void CreatePacketServer(ClientStackUserSettings userSettings)
|
||||
{
|
||||
new LLPacketServer(this);
|
||||
new LLPacketServer(this, userSettings);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user