From 743e336bf340f623a50bebd53d98798c04eb0345 Mon Sep 17 00:00:00 2001
From: Justin Clarke Casey
Date: Fri, 3 Oct 2008 18:06:45 +0000
Subject: * 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
---
.../Region/ClientStack/LindenUDP/LLPacketHandler.cs | 4 ++--
OpenSim/Region/ClientStack/LindenUDP/LLPacketQueue.cs | 19 ++++++++++++++-----
.../Region/ClientStack/LindenUDP/LLPacketServer.cs | 13 +++++++++++--
OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs | 16 ++++++++++------
4 files changed, 37 insertions(+), 15 deletions(-)
(limited to 'OpenSim/Region/ClientStack/LindenUDP')
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLPacketHandler.cs b/OpenSim/Region/ClientStack/LindenUDP/LLPacketHandler.cs
index 78a916d..da62a80 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLPacketHandler.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLPacketHandler.cs
@@ -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();
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLPacketQueue.cs b/OpenSim/Region/ClientStack/LindenUDP/LLPacketQueue.cs
index e4e5e9a..1e03c88 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLPacketQueue.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLPacketQueue.cs
@@ -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);
///
- /// Is throttling enabled at all?
+ /// Is queueing enabled at all?
///
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();
AssetOutgoingPacketQueue = new Queue();
-
// 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);
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLPacketServer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLPacketServer.cs
index 1261666..e2d2226 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLPacketServer.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLPacketServer.cs
@@ -47,10 +47,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP
//{
// get { return m_clientManager; }
//}
+
+ ///
+ /// Tweakable user settings
+ ///
+ 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);
}
///
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
index c20c7bc..8643382 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
@@ -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);
}
///
@@ -142,10 +144,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
///
///
///
+ ///
///
///
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);
}
///
--
cgit v1.1