aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorJustin Clarke Casey2008-10-03 18:06:45 +0000
committerJustin Clarke Casey2008-10-03 18:06:45 +0000
commit743e336bf340f623a50bebd53d98798c04eb0345 (patch)
treed6a0055ff71d99e7c0e132bb7ae51d0922949e0c /OpenSim
parentCause objects to be removed from the database when they go temp or get (diff)
downloadopensim-SC_OLD-743e336bf340f623a50bebd53d98798c04eb0345.zip
opensim-SC_OLD-743e336bf340f623a50bebd53d98798c04eb0345.tar.gz
opensim-SC_OLD-743e336bf340f623a50bebd53d98798c04eb0345.tar.bz2
opensim-SC_OLD-743e336bf340f623a50bebd53d98798c04eb0345.tar.xz
* 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
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/ClientStack/ClientStackManager.cs17
-rw-r--r--OpenSim/Region/ClientStack/ClientStackUserSettings.cs43
-rw-r--r--OpenSim/Region/ClientStack/IClientNetworkServer.cs4
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLPacketHandler.cs4
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLPacketQueue.cs19
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLPacketServer.cs13
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs16
-rw-r--r--OpenSim/Region/ClientStack/RegionApplicationBase.cs7
-rw-r--r--OpenSim/Region/ClientStack/ThrottleSettings.cs57
9 files changed, 158 insertions, 22 deletions
diff --git a/OpenSim/Region/ClientStack/ClientStackManager.cs b/OpenSim/Region/ClientStack/ClientStackManager.cs
index b5cd06a..0b0c07f 100644
--- a/OpenSim/Region/ClientStack/ClientStackManager.cs
+++ b/OpenSim/Region/ClientStack/ClientStackManager.cs
@@ -43,10 +43,11 @@ namespace OpenSim.Region.Environment
43 private Type plugin; 43 private Type plugin;
44 private Assembly pluginAssembly; 44 private Assembly pluginAssembly;
45 45
46 public ClientStackManager(string dllName) { 46 public ClientStackManager(string dllName)
47 {
47 m_log.Info("[CLIENTSTACK]: Attempting to load " + dllName); 48 m_log.Info("[CLIENTSTACK]: Attempting to load " + dllName);
48 49
49 plugin=null; 50 plugin = null;
50 pluginAssembly = Assembly.LoadFrom(dllName); 51 pluginAssembly = Assembly.LoadFrom(dllName);
51 52
52 foreach (Type pluginType in pluginAssembly.GetTypes()) 53 foreach (Type pluginType in pluginAssembly.GetTypes())
@@ -65,16 +66,22 @@ namespace OpenSim.Region.Environment
65 } 66 }
66 } 67 }
67 68
68 public IClientNetworkServer CreateServer(IPAddress _listenIP, ref uint port, int proxyPortOffset, bool allow_alternate_port, AssetCache assetCache, AgentCircuitManager authenticateClass) 69 public IClientNetworkServer CreateServer(
70 IPAddress _listenIP, ref uint port, int proxyPortOffset, bool allow_alternate_port, ClientStackUserSettings settings,
71 AssetCache assetCache, AgentCircuitManager authenticateClass)
69 { 72 {
70 if (plugin != null) 73 if (plugin != null)
71 { 74 {
72 IClientNetworkServer server = 75 IClientNetworkServer server =
73 (IClientNetworkServer) Activator.CreateInstance(pluginAssembly.GetType(plugin.ToString())); 76 (IClientNetworkServer) Activator.CreateInstance(pluginAssembly.GetType(plugin.ToString()));
74 server.Initialise(_listenIP, ref port, proxyPortOffset, allow_alternate_port, assetCache, authenticateClass); 77
78 server.Initialise(
79 _listenIP, ref port, proxyPortOffset, allow_alternate_port, settings, assetCache, authenticateClass);
80
75 return server; 81 return server;
76 } 82 }
77 m_log.Error("[CLIENTSTACK] Couldn't initialize a new server"); 83
84 m_log.Error("[CLIENTSTACK]: Couldn't initialize a new server");
78 return null; 85 return null;
79 } 86 }
80 } 87 }
diff --git a/OpenSim/Region/ClientStack/ClientStackUserSettings.cs b/OpenSim/Region/ClientStack/ClientStackUserSettings.cs
new file mode 100644
index 0000000..d34ae34
--- /dev/null
+++ b/OpenSim/Region/ClientStack/ClientStackUserSettings.cs
@@ -0,0 +1,43 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSim Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28namespace OpenSim.Region.ClientStack
29{
30 /// <summary>
31 /// Allow users to tweak parameters for the client stack.
32 ///
33 /// At the moment this is very incomplete - other tweakable settings could be added. This is also somewhat LL client
34 /// oriented right now.
35 /// </summary>
36 public class ClientStackUserSettings
37 {
38 /// <summary>
39 /// The settings for the throttle that governs how many packets in total are sent to the client.
40 /// </summary>
41 public ThrottleSettings TotalThrottleSettings;
42 }
43}
diff --git a/OpenSim/Region/ClientStack/IClientNetworkServer.cs b/OpenSim/Region/ClientStack/IClientNetworkServer.cs
index 817e8af..fcec1b8 100644
--- a/OpenSim/Region/ClientStack/IClientNetworkServer.cs
+++ b/OpenSim/Region/ClientStack/IClientNetworkServer.cs
@@ -35,7 +35,9 @@ namespace OpenSim.Region.ClientStack
35{ 35{
36 public interface IClientNetworkServer 36 public interface IClientNetworkServer
37 { 37 {
38 void Initialise(IPAddress _listenIP, ref uint port, int proxyPortOffsetParm, bool allow_alternate_port, AssetCache assetCache, AgentCircuitManager authenticateClass); 38 void Initialise(
39 IPAddress _listenIP, ref uint port, int proxyPortOffsetParm, bool allow_alternate_port, ClientStackUserSettings settings,
40 AssetCache assetCache, AgentCircuitManager authenticateClass);
39 41
40 Socket Server { get; } 42 Socket Server { get; }
41 bool HandlesRegion(Location x); 43 bool HandlesRegion(Location x);
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
219 219
220 // Constructors 220 // Constructors
221 // 221 //
222 public LLPacketHandler(IClientAPI client, LLPacketServer server) 222 public LLPacketHandler(IClientAPI client, LLPacketServer server, ClientStackUserSettings userSettings)
223 { 223 {
224 m_Client = client; 224 m_Client = client;
225 m_PacketServer = server; 225 m_PacketServer = server;
226 226
227 m_PacketQueue = new LLPacketQueue(client.AgentId); 227 m_PacketQueue = new LLPacketQueue(client.AgentId, userSettings);
228 228
229 m_AckTimer.Elapsed += AckTimerElapsed; 229 m_AckTimer.Elapsed += AckTimerElapsed;
230 m_AckTimer.Start(); 230 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;
34using OpenSim.Framework; 34using OpenSim.Framework;
35using OpenSim.Framework.Statistics; 35using OpenSim.Framework.Statistics;
36using OpenSim.Framework.Statistics.Interfaces; 36using OpenSim.Framework.Statistics.Interfaces;
37using OpenSim.Region.ClientStack;
37using Timer=System.Timers.Timer; 38using Timer=System.Timers.Timer;
38 39
39 40
@@ -45,7 +46,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
45 = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); 46 = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
46 47
47 /// <summary> 48 /// <summary>
48 /// Is throttling enabled at all? 49 /// Is queueing enabled at all?
49 /// </summary> 50 /// </summary>
50 private bool m_enabled = true; 51 private bool m_enabled = true;
51 52
@@ -88,7 +89,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
88 89
89 private UUID m_agentId; 90 private UUID m_agentId;
90 91
91 public LLPacketQueue(UUID agentId) 92 public LLPacketQueue(UUID agentId, ClientStackUserSettings userSettings)
92 { 93 {
93 // While working on this, the BlockingQueue had me fooled for a bit. 94 // While working on this, the BlockingQueue had me fooled for a bit.
94 // The Blocking queue causes the thread to stop until there's something 95 // The Blocking queue causes the thread to stop until there's something
@@ -108,7 +109,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
108 TextureOutgoingPacketQueue = new Queue<LLQueItem>(); 109 TextureOutgoingPacketQueue = new Queue<LLQueItem>();
109 AssetOutgoingPacketQueue = new Queue<LLQueItem>(); 110 AssetOutgoingPacketQueue = new Queue<LLQueItem>();
110 111
111
112 // Set up the throttle classes (min, max, current) in bytes 112 // Set up the throttle classes (min, max, current) in bytes
113 ResendThrottle = new LLPacketThrottle(5000, 100000, 16000); 113 ResendThrottle = new LLPacketThrottle(5000, 100000, 16000);
114 LandThrottle = new LLPacketThrottle(1000, 100000, 2000); 114 LandThrottle = new LLPacketThrottle(1000, 100000, 2000);
@@ -117,9 +117,18 @@ namespace OpenSim.Region.ClientStack.LindenUDP
117 TaskThrottle = new LLPacketThrottle(1000, 800000, 3000); 117 TaskThrottle = new LLPacketThrottle(1000, 800000, 3000);
118 AssetThrottle = new LLPacketThrottle(1000, 800000, 1000); 118 AssetThrottle = new LLPacketThrottle(1000, 800000, 1000);
119 TextureThrottle = new LLPacketThrottle(1000, 800000, 4000); 119 TextureThrottle = new LLPacketThrottle(1000, 800000, 4000);
120
120 // Total Throttle trumps all 121 // Total Throttle trumps all
121 // Number of bytes allowed to go out per second. (256kbps per client) 122 // Number of bytes allowed to go out per second.
122 TotalThrottle = new LLPacketThrottle(0, 1500000, 28000); 123 ThrottleSettings totalThrottleSettings = userSettings.TotalThrottleSettings;
124 if (null == totalThrottleSettings)
125 {
126 totalThrottleSettings = new ThrottleSettings(0, 1500000, 28000);
127 }
128
129 TotalThrottle
130 = new LLPacketThrottle(
131 totalThrottleSettings.Min, totalThrottleSettings.Max, totalThrottleSettings.Current);
123 132
124 throttleTimer = new Timer((int) (throttletimems/throttleTimeDivisor)); 133 throttleTimer = new Timer((int) (throttletimems/throttleTimeDivisor));
125 throttleTimer.Elapsed += new ElapsedEventHandler(ThrottleTimerElapsed); 134 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
47 //{ 47 //{
48 // get { return m_clientManager; } 48 // get { return m_clientManager; }
49 //} 49 //}
50
51 /// <summary>
52 /// Tweakable user settings
53 /// </summary>
54 private ClientStackUserSettings m_userSettings;
50 55
51 public LLPacketServer(ILLClientStackNetworkHandler networkHandler) 56 public LLPacketServer(ILLClientStackNetworkHandler networkHandler, ClientStackUserSettings userSettings)
52 { 57 {
58 m_userSettings = userSettings;
53 m_networkHandler = networkHandler; 59 m_networkHandler = networkHandler;
60
54 m_networkHandler.RegisterPacketServer(this); 61 m_networkHandler.RegisterPacketServer(this);
55 } 62 }
56 63
@@ -90,7 +97,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
90 UUID agentId, UUID sessionId, uint circuitCode, EndPoint proxyEP) 97 UUID agentId, UUID sessionId, uint circuitCode, EndPoint proxyEP)
91 { 98 {
92 return 99 return
93 new LLClientView(remoteEP, scene, assetCache, packServer, authenSessions, agentId, sessionId, circuitCode, proxyEP); 100 new LLClientView(
101 remoteEP, scene, assetCache, packServer, authenSessions, agentId, sessionId, circuitCode, proxyEP,
102 m_userSettings);
94 } 103 }
95 104
96 /// <summary> 105 /// <summary>
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
130 { 130 {
131 } 131 }
132 132
133 public LLUDPServer(IPAddress _listenIP, ref uint port, int proxyPortOffset, bool allow_alternate_port, AssetCache assetCache, AgentCircuitManager authenticateClass) 133 public LLUDPServer(
134 IPAddress _listenIP, ref uint port, int proxyPortOffset, bool allow_alternate_port, ClientStackUserSettings userSettings,
135 AssetCache assetCache, AgentCircuitManager authenticateClass)
134 { 136 {
135 Initialise(_listenIP, ref port, proxyPortOffset, allow_alternate_port, assetCache, authenticateClass); 137 Initialise(_listenIP, ref port, proxyPortOffset, allow_alternate_port, userSettings, assetCache, authenticateClass);
136 } 138 }
137 139
138 /// <summary> 140 /// <summary>
@@ -142,10 +144,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
142 /// <param name="port"></param> 144 /// <param name="port"></param>
143 /// <param name="proxyPortOffsetParm"></param> 145 /// <param name="proxyPortOffsetParm"></param>
144 /// <param name="allow_alternate_port"></param> 146 /// <param name="allow_alternate_port"></param>
147 /// <param name="settings"></param>
145 /// <param name="assetCache"></param> 148 /// <param name="assetCache"></param>
146 /// <param name="circuitManager"></param> 149 /// <param name="circuitManager"></param>
147 public void Initialise( 150 public void Initialise(
148 IPAddress _listenIP, ref uint port, int proxyPortOffsetParm, bool allow_alternate_port, AssetCache assetCache, AgentCircuitManager circuitManager) 151 IPAddress _listenIP, ref uint port, int proxyPortOffsetParm, bool allow_alternate_port, ClientStackUserSettings userSettings,
152 AssetCache assetCache, AgentCircuitManager circuitManager)
149 { 153 {
150 proxyPortOffset = proxyPortOffsetParm; 154 proxyPortOffset = proxyPortOffsetParm;
151 listenPort = (uint) (port + proxyPortOffsetParm); 155 listenPort = (uint) (port + proxyPortOffsetParm);
@@ -153,7 +157,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
153 Allow_Alternate_Port = allow_alternate_port; 157 Allow_Alternate_Port = allow_alternate_port;
154 m_assetCache = assetCache; 158 m_assetCache = assetCache;
155 m_circuitManager = circuitManager; 159 m_circuitManager = circuitManager;
156 CreatePacketServer(); 160 CreatePacketServer(userSettings);
157 161
158 // Return new port 162 // Return new port
159 // This because in Grid mode it is not really important what port the region listens to as long as it is correctly registered. 163 // 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
161 port = (uint)(listenPort - proxyPortOffsetParm); 165 port = (uint)(listenPort - proxyPortOffsetParm);
162 } 166 }
163 167
164 protected virtual void CreatePacketServer() 168 protected virtual void CreatePacketServer(ClientStackUserSettings userSettings)
165 { 169 {
166 new LLPacketServer(this); 170 new LLPacketServer(this, userSettings);
167 } 171 }
168 172
169 /// <summary> 173 /// <summary>
diff --git a/OpenSim/Region/ClientStack/RegionApplicationBase.cs b/OpenSim/Region/ClientStack/RegionApplicationBase.cs
index cee7ffa..4db2907 100644
--- a/OpenSim/Region/ClientStack/RegionApplicationBase.cs
+++ b/OpenSim/Region/ClientStack/RegionApplicationBase.cs
@@ -123,7 +123,12 @@ namespace OpenSim.Region.ClientStack
123 // listenIP = IPAddress.Parse("0.0.0.0"); 123 // listenIP = IPAddress.Parse("0.0.0.0");
124 124
125 uint port = (uint) regionInfo.InternalEndPoint.Port; 125 uint port = (uint) regionInfo.InternalEndPoint.Port;
126 clientServer = m_clientStackManager.CreateServer(listenIP, ref port, proxyOffset, regionInfo.m_allow_alternate_ports, m_assetCache, circuitManager); 126
127 clientServer
128 = m_clientStackManager.CreateServer(
129 listenIP, ref port, proxyOffset, regionInfo.m_allow_alternate_ports, new ClientStackUserSettings(),
130 m_assetCache, circuitManager);
131
127 regionInfo.InternalEndPoint.Port = (int)port; 132 regionInfo.InternalEndPoint.Port = (int)port;
128 133
129 Scene scene = CreateScene(regionInfo, m_storageManager, circuitManager); 134 Scene scene = CreateScene(regionInfo, m_storageManager, circuitManager);
diff --git a/OpenSim/Region/ClientStack/ThrottleSettings.cs b/OpenSim/Region/ClientStack/ThrottleSettings.cs
new file mode 100644
index 0000000..ca537c6
--- /dev/null
+++ b/OpenSim/Region/ClientStack/ThrottleSettings.cs
@@ -0,0 +1,57 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSim Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28namespace OpenSim.Region.ClientStack
29{
30 /// <summary>
31 /// Represent throttle settings for a client stack. These settings are in bytes per second
32 /// </summary>
33 public class ThrottleSettings
34 {
35 /// <summary>
36 /// Minimum bytes per second that the throttle can be set to.
37 /// </summary>
38 public int Min;
39
40 /// <summary>
41 /// Maximum bytes per second that the throttle can be set to.
42 /// </summary>
43 public int Max;
44
45 /// <summary>
46 /// Current bytes per second that the throttle should be set to.
47 /// </summary>
48 public int Current;
49
50 public ThrottleSettings(int min, int max, int current)
51 {
52 Min = min;
53 Max = max;
54 Current = current;
55 }
56 }
57}