diff options
author | lbsa71 | 2007-12-06 14:08:22 +0000 |
---|---|---|
committer | lbsa71 | 2007-12-06 14:08:22 +0000 |
commit | 395637acddca473380d09ba23acc3b6db0814e75 (patch) | |
tree | dcf1889423fc957ba0eedea918a15514eb543562 /OpenSim | |
parent | Fixed conversation bug in InventoryConfig (diff) | |
download | opensim-SC-395637acddca473380d09ba23acc3b6db0814e75.zip opensim-SC-395637acddca473380d09ba23acc3b6db0814e75.tar.gz opensim-SC-395637acddca473380d09ba23acc3b6db0814e75.tar.bz2 opensim-SC-395637acddca473380d09ba23acc3b6db0814e75.tar.xz |
* now the throttle timer is stopped whilst processing Queue so that it won't fire twice
* started to refactored throttling method
* some code convention refactorings
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Framework/Communications/Cache/AssetCache.cs | 7 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/ClientView.cs | 572 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Scene.cs | 1 |
3 files changed, 308 insertions, 272 deletions
diff --git a/OpenSim/Framework/Communications/Cache/AssetCache.cs b/OpenSim/Framework/Communications/Cache/AssetCache.cs index cb8b9f6..64e0e54 100644 --- a/OpenSim/Framework/Communications/Cache/AssetCache.cs +++ b/OpenSim/Framework/Communications/Cache/AssetCache.cs | |||
@@ -776,8 +776,13 @@ namespace OpenSim.Framework.Communications.Cache | |||
776 | im.Header.Reliable = false; | 776 | im.Header.Reliable = false; |
777 | im.ImageID.Packet = (ushort) (req.PacketCounter); | 777 | im.ImageID.Packet = (ushort) (req.PacketCounter); |
778 | im.ImageID.ID = req.ImageInfo.FullID; | 778 | im.ImageID.ID = req.ImageInfo.FullID; |
779 | |||
779 | int size = req.ImageInfo.Data.Length - 600 - (1000*(req.PacketCounter - 1)); | 780 | int size = req.ImageInfo.Data.Length - 600 - (1000*(req.PacketCounter - 1)); |
780 | if (size > 1000) size = 1000; | 781 | if (size > 1000) |
782 | { | ||
783 | size = 1000; | ||
784 | } | ||
785 | |||
781 | //Console.WriteLine("length= {0} counter= {1} size= {2}",req.ImageInfo.Data.Length, req.PacketCounter, size); | 786 | //Console.WriteLine("length= {0} counter= {1} size= {2}",req.ImageInfo.Data.Length, req.PacketCounter, size); |
782 | im.ImageData.Data = new byte[size]; | 787 | im.ImageData.Data = new byte[size]; |
783 | Array.Copy(req.ImageInfo.Data, 600 + (1000*(req.PacketCounter - 1)), im.ImageData.Data, 0, size); | 788 | Array.Copy(req.ImageInfo.Data, 600 + (1000*(req.PacketCounter - 1)), im.ImageData.Data, 0, size); |
diff --git a/OpenSim/Region/ClientStack/ClientView.cs b/OpenSim/Region/ClientStack/ClientView.cs index 724fccc..415b04e 100644 --- a/OpenSim/Region/ClientStack/ClientView.cs +++ b/OpenSim/Region/ClientStack/ClientView.cs | |||
@@ -91,62 +91,62 @@ namespace OpenSim.Region.ClientStack | |||
91 | protected AgentCircuitManager m_authenticateSessionsHandler; | 91 | protected AgentCircuitManager m_authenticateSessionsHandler; |
92 | private Encoding enc = Encoding.ASCII; | 92 | private Encoding enc = Encoding.ASCII; |
93 | // Dead client detection vars | 93 | // Dead client detection vars |
94 | private Timer clientPingTimer; | 94 | private Timer m_clientPingTimer; |
95 | private int packetsReceived = 0; | 95 | private int m_packetsReceived = 0; |
96 | private int probesWithNoIngressPackets = 0; | 96 | private int m_probesWithNoIngressPackets = 0; |
97 | private int lastPacketsReceived = 0; | 97 | private int m_lastPacketsReceived = 0; |
98 | 98 | ||
99 | // 1536000 | 99 | // 1536000 |
100 | private int throttleOutboundMax = 1536000; // Number of bytes allowed to go out per second. (256kbps per client) | 100 | private int m_throttleOutboundMax = 1536000; // Number of bytes allowed to go out per second. (256kbps per client) |
101 | // TODO: Make this variable. Lower throttle on un-ack. Raise over time? | 101 | // TODO: Make this variable. Lower throttle on un-ack. Raise over time? |
102 | private int bytesSent = 0; // Number of bytes sent this period | 102 | private int m_bytesSent = 0; // Number of bytes sent this period |
103 | 103 | ||
104 | private int throttleOutbound = 162144; // Number of bytes allowed to go out per second. (256kbps per client) | 104 | private int m_throttleOutbound = 162144; // Number of bytes allowed to go out per second. (256kbps per client) |
105 | // TODO: Make this variable. Lower throttle on un-ack. Raise over time | 105 | // TODO: Make this variable. Lower throttle on un-ack. Raise over time |
106 | 106 | ||
107 | // All throttle times and number of bytes are calculated by dividing by this value | 107 | // All throttle times and number of bytes are calculated by dividing by this value |
108 | // This value also determines how many times per throttletimems the timer will run | 108 | // This value also determines how many times per throttletimems the timer will run |
109 | // If throttleimems is 1000 ms, then the timer will fire every 1000/7 milliseconds | 109 | // If throttleimems is 1000 ms, then the timer will fire every 1000/7 milliseconds |
110 | 110 | ||
111 | private int throttleTimeDivisor = 7; | 111 | private int m_throttleTimeDivisor = 7; |
112 | 112 | ||
113 | private int throttletimems = 1000; | 113 | private int m_throttletimems = 1000; |
114 | 114 | ||
115 | // Maximum -per type- throttle | 115 | // Maximum -per type- throttle |
116 | private int ResendthrottleMAX = 100000; | 116 | private int m_resendthrottleMAX = 100000; |
117 | private int LandthrottleMax = 100000; | 117 | private int m_landthrottleMax = 100000; |
118 | private int WindthrottleMax = 100000; | 118 | private int m_windthrottleMax = 100000; |
119 | private int CloudthrottleMax = 100000; | 119 | private int m_cloudthrottleMax = 100000; |
120 | private int TaskthrottleMax = 800000; | 120 | private int m_taskthrottleMax = 800000; |
121 | private int AssetthrottleMax = 800000; | 121 | private int m_assetthrottleMax = 800000; |
122 | private int TexturethrottleMax = 800000; | 122 | private int m_texturethrottleMax = 800000; |
123 | 123 | ||
124 | // Minimum -per type- throttle | 124 | // Minimum -per type- throttle |
125 | private int ResendthrottleMin = 5000; // setting resendmin to 0 results in mostly dropped packets | 125 | private int m_resendthrottleMin = 5000; // setting resendmin to 0 results in mostly dropped packets |
126 | private int LandthrottleMin = 1000; | 126 | private int m_landthrottleMin = 1000; |
127 | private int WindthrottleMin = 1000; | 127 | private int m_windthrottleMin = 1000; |
128 | private int CloudthrottleMin = 1000; | 128 | private int m_cloudthrottleMin = 1000; |
129 | private int TaskthrottleMin = 1000; | 129 | private int m_taskthrottleMin = 1000; |
130 | private int AssetthrottleMin = 1000; | 130 | private int m_assetthrottleMin = 1000; |
131 | private int TexturethrottleMin = 1000; | 131 | private int m_texturethrottleMin = 1000; |
132 | 132 | ||
133 | // Sim default per-client settings. | 133 | // Sim default per-client settings. |
134 | private int ResendthrottleOutbound = 50000; | 134 | private int m_resendthrottleOutbound = 50000; |
135 | private int ResendBytesSent = 0; | 135 | private int m_resendBytesSent = 0; |
136 | private int LandthrottleOutbound = 100000; | 136 | private int m_landthrottleOutbound = 100000; |
137 | private int LandBytesSent = 0; | 137 | private int m_landBytesSent = 0; |
138 | private int WindthrottleOutbound = 10000; | 138 | private int m_windthrottleOutbound = 10000; |
139 | private int WindBytesSent = 0; | 139 | private int m_windBytesSent = 0; |
140 | private int CloudthrottleOutbound = 5000; | 140 | private int m_cloudthrottleOutbound = 5000; |
141 | private int CloudBytesSent = 0; | 141 | private int m_cloudBytesSent = 0; |
142 | private int TaskthrottleOutbound = 100000; | 142 | private int m_taskthrottleOutbound = 100000; |
143 | private int TaskBytesSent = 0; | 143 | private int m_taskBytesSent = 0; |
144 | private int AssetthrottleOutbound = 80000; | 144 | private int m_assetthrottleOutbound = 80000; |
145 | private int AssetBytesSent = 0; | 145 | private int m_assetBytesSent = 0; |
146 | private int TexturethrottleOutbound = 100000; | 146 | private int m_texturethrottleOutbound = 100000; |
147 | private int TextureBytesSent = 0; | 147 | private int m_textureBytesSent = 0; |
148 | 148 | ||
149 | private Timer throttleTimer; | 149 | private Timer m_throttleTimer; |
150 | 150 | ||
151 | public ClientView(EndPoint remoteEP, UseCircuitCodePacket initialcirpack, ClientManager clientManager, | 151 | public ClientView(EndPoint remoteEP, UseCircuitCodePacket initialcirpack, ClientManager clientManager, |
152 | IScene scene, AssetCache assetCache, PacketServer packServer, | 152 | IScene scene, AssetCache assetCache, PacketServer packServer, |
@@ -174,17 +174,17 @@ namespace OpenSim.Region.ClientStack | |||
174 | // in it to process. it's an on-purpose threadlock though because | 174 | // in it to process. it's an on-purpose threadlock though because |
175 | // without it, the clientloop will suck up all sim resources. | 175 | // without it, the clientloop will suck up all sim resources. |
176 | 176 | ||
177 | PacketQueue = new BlockingQueue<QueItem>(); | 177 | m_packetQueue = new BlockingQueue<QueItem>(); |
178 | 178 | ||
179 | IncomingPacketQueue = new Queue<QueItem>(); | 179 | m_incomingPacketQueue = new Queue<QueItem>(); |
180 | OutgoingPacketQueue = new Queue<QueItem>(); | 180 | m_outgoingPacketQueue = new Queue<QueItem>(); |
181 | ResendOutgoingPacketQueue = new Queue<QueItem>(); | 181 | m_resendOutgoingPacketQueue = new Queue<QueItem>(); |
182 | LandOutgoingPacketQueue = new Queue<QueItem>(); | 182 | m_landOutgoingPacketQueue = new Queue<QueItem>(); |
183 | WindOutgoingPacketQueue = new Queue<QueItem>(); | 183 | m_windOutgoingPacketQueue = new Queue<QueItem>(); |
184 | CloudOutgoingPacketQueue = new Queue<QueItem>(); | 184 | m_cloudOutgoingPacketQueue = new Queue<QueItem>(); |
185 | TaskOutgoingPacketQueue = new Queue<QueItem>(); | 185 | m_taskOutgoingPacketQueue = new Queue<QueItem>(); |
186 | TextureOutgoingPacketQueue = new Queue<QueItem>(); | 186 | m_textureOutgoingPacketQueue = new Queue<QueItem>(); |
187 | AssetOutgoingPacketQueue = new Queue<QueItem>(); | 187 | m_assetOutgoingPacketQueue = new Queue<QueItem>(); |
188 | 188 | ||
189 | 189 | ||
190 | //this.UploadAssets = new AgentAssetUpload(this, m_assetCache, m_inventoryCache); | 190 | //this.UploadAssets = new AgentAssetUpload(this, m_assetCache, m_inventoryCache); |
@@ -192,9 +192,9 @@ namespace OpenSim.Region.ClientStack | |||
192 | AckTimer.Elapsed += new ElapsedEventHandler(AckTimer_Elapsed); | 192 | AckTimer.Elapsed += new ElapsedEventHandler(AckTimer_Elapsed); |
193 | AckTimer.Start(); | 193 | AckTimer.Start(); |
194 | 194 | ||
195 | throttleTimer = new Timer((int)(throttletimems/throttleTimeDivisor)); | 195 | m_throttleTimer = new Timer((int)(m_throttletimems/m_throttleTimeDivisor)); |
196 | throttleTimer.Elapsed += new ElapsedEventHandler(throttleTimer_Elapsed); | 196 | m_throttleTimer.Elapsed += throttleTimer_Elapsed; |
197 | throttleTimer.Start(); | 197 | m_throttleTimer.Start(); |
198 | 198 | ||
199 | RegisterLocalPacketHandlers(); | 199 | RegisterLocalPacketHandlers(); |
200 | 200 | ||
@@ -205,14 +205,24 @@ namespace OpenSim.Region.ClientStack | |||
205 | 205 | ||
206 | void throttleTimer_Elapsed(object sender, ElapsedEventArgs e) | 206 | void throttleTimer_Elapsed(object sender, ElapsedEventArgs e) |
207 | { | 207 | { |
208 | bytesSent = 0; | 208 | // We need to stop the timer so that another timer event won't cause queue races. |
209 | ResendBytesSent = 0; | 209 | m_throttleTimer.Stop(); |
210 | LandBytesSent = 0; | 210 | |
211 | WindBytesSent = 0; | 211 | ProcessThrottleQueues(); |
212 | CloudBytesSent = 0; | 212 | |
213 | TaskBytesSent = 0; | 213 | m_throttleTimer.Start(); |
214 | AssetBytesSent = 0; | 214 | } |
215 | TextureBytesSent = 0; | 215 | |
216 | private void ProcessThrottleQueues() | ||
217 | { | ||
218 | m_bytesSent = 0; | ||
219 | m_resendBytesSent = 0; | ||
220 | m_landBytesSent = 0; | ||
221 | m_windBytesSent = 0; | ||
222 | m_cloudBytesSent = 0; | ||
223 | m_taskBytesSent = 0; | ||
224 | m_assetBytesSent = 0; | ||
225 | m_textureBytesSent = 0; | ||
216 | 226 | ||
217 | // I was considering this.. Will an event fire if the thread it's on is blocked? | 227 | // I was considering this.. Will an event fire if the thread it's on is blocked? |
218 | 228 | ||
@@ -225,76 +235,96 @@ namespace OpenSim.Region.ClientStack | |||
225 | 235 | ||
226 | // We're going to dequeue all of the saved up packets until | 236 | // We're going to dequeue all of the saved up packets until |
227 | // we've hit the throttle limit or there's no more packets to send | 237 | // we've hit the throttle limit or there's no more packets to send |
228 | while ((bytesSent <= ((int)(throttleOutbound/throttleTimeDivisor)) && | 238 | |
229 | (ResendOutgoingPacketQueue.Count > 0 || | 239 | |
230 | LandOutgoingPacketQueue.Count > 0 || | 240 | |
231 | WindOutgoingPacketQueue.Count > 0 || | 241 | while (TimeToDequeue( m_bytesSent, m_throttleOutbound ) && |
232 | CloudOutgoingPacketQueue.Count > 0 || | 242 | (m_resendOutgoingPacketQueue.Count > 0 || |
233 | TaskOutgoingPacketQueue.Count > 0 || | 243 | m_landOutgoingPacketQueue.Count > 0 || |
234 | AssetOutgoingPacketQueue.Count > 0 || | 244 | m_windOutgoingPacketQueue.Count > 0 || |
235 | TextureOutgoingPacketQueue.Count > 0)) && throttleLoops <= MaxThrottleLoops) | 245 | m_cloudOutgoingPacketQueue.Count > 0 || |
246 | m_taskOutgoingPacketQueue.Count > 0 || | ||
247 | m_assetOutgoingPacketQueue.Count > 0 || | ||
248 | m_textureOutgoingPacketQueue.Count > 0) && ( throttleLoops <= MaxThrottleLoops)) | ||
236 | { | 249 | { |
237 | throttleLoops++; | 250 | throttleLoops++; |
238 | //Now comes the fun part.. we dump all our elements into PacketQueue that we've saved up. | 251 | //Now comes the fun part.. we dump all our elements into PacketQueue that we've saved up. |
239 | if (ResendBytesSent <= ((int)(ResendthrottleOutbound/throttleTimeDivisor)) && ResendOutgoingPacketQueue.Count > 0) | ||
240 | { | ||
241 | QueItem qpack = ResendOutgoingPacketQueue.Dequeue(); | ||
242 | 252 | ||
243 | PacketQueue.Enqueue(qpack); | 253 | if (TimeToDequeue(m_resendBytesSent, m_resendthrottleOutbound)) |
244 | bytesSent += qpack.Packet.ToBytes().Length; | ||
245 | ResendBytesSent += qpack.Packet.ToBytes().Length; | ||
246 | } | ||
247 | if (LandBytesSent <= ((int)(LandthrottleOutbound/throttleTimeDivisor)) && LandOutgoingPacketQueue.Count > 0) | ||
248 | { | 254 | { |
249 | QueItem qpack = LandOutgoingPacketQueue.Dequeue(); | 255 | m_resendBytesSent += ProcessQueue(m_resendOutgoingPacketQueue); |
256 | } | ||
250 | 257 | ||
251 | PacketQueue.Enqueue(qpack); | 258 | if (TimeToDequeue(m_landBytesSent, m_landthrottleOutbound)) |
252 | bytesSent += qpack.Packet.ToBytes().Length; | 259 | { |
253 | LandBytesSent += qpack.Packet.ToBytes().Length; | 260 | m_landBytesSent += ProcessQueue(m_landOutgoingPacketQueue); |
254 | } | 261 | } |
255 | if (WindBytesSent <= ((int)(WindthrottleOutbound/throttleTimeDivisor)) && WindOutgoingPacketQueue.Count > 0) | 262 | |
263 | // -- TODO: Well, do the same for the rest of them | ||
264 | |||
265 | if (m_windBytesSent <= ((int)(m_windthrottleOutbound/m_throttleTimeDivisor)) && m_windOutgoingPacketQueue.Count > 0) | ||
256 | { | 266 | { |
257 | QueItem qpack = WindOutgoingPacketQueue.Dequeue(); | 267 | QueItem qpack = m_windOutgoingPacketQueue.Dequeue(); |
258 | 268 | ||
259 | PacketQueue.Enqueue(qpack); | 269 | m_packetQueue.Enqueue(qpack); |
260 | bytesSent += qpack.Packet.ToBytes().Length; | 270 | m_bytesSent += qpack.Packet.ToBytes().Length; |
261 | WindBytesSent += qpack.Packet.ToBytes().Length; | 271 | m_windBytesSent += qpack.Packet.ToBytes().Length; |
262 | } | 272 | } |
263 | if (CloudBytesSent <= ((int)(CloudthrottleOutbound/throttleTimeDivisor)) && CloudOutgoingPacketQueue.Count > 0) | 273 | if (m_cloudBytesSent <= ((int)(m_cloudthrottleOutbound/m_throttleTimeDivisor)) && m_cloudOutgoingPacketQueue.Count > 0) |
264 | { | 274 | { |
265 | QueItem qpack = CloudOutgoingPacketQueue.Dequeue(); | 275 | QueItem qpack = m_cloudOutgoingPacketQueue.Dequeue(); |
266 | 276 | ||
267 | PacketQueue.Enqueue(qpack); | 277 | m_packetQueue.Enqueue(qpack); |
268 | bytesSent += qpack.Packet.ToBytes().Length; | 278 | m_bytesSent += qpack.Packet.ToBytes().Length; |
269 | CloudBytesSent += qpack.Packet.ToBytes().Length; | 279 | m_cloudBytesSent += qpack.Packet.ToBytes().Length; |
270 | } | 280 | } |
271 | if (TaskBytesSent <= ((int)(TaskthrottleOutbound/throttleTimeDivisor)) && TaskOutgoingPacketQueue.Count > 0) | 281 | if (m_taskBytesSent <= ((int)(m_taskthrottleOutbound/m_throttleTimeDivisor)) && m_taskOutgoingPacketQueue.Count > 0) |
272 | { | 282 | { |
273 | QueItem qpack = TaskOutgoingPacketQueue.Dequeue(); | 283 | QueItem qpack = m_taskOutgoingPacketQueue.Dequeue(); |
274 | 284 | ||
275 | PacketQueue.Enqueue(qpack); | 285 | m_packetQueue.Enqueue(qpack); |
276 | bytesSent += qpack.Packet.ToBytes().Length; | 286 | m_bytesSent += qpack.Packet.ToBytes().Length; |
277 | TaskBytesSent += qpack.Packet.ToBytes().Length; | 287 | m_taskBytesSent += qpack.Packet.ToBytes().Length; |
278 | } | 288 | } |
279 | if (TextureBytesSent <= ((int)(TexturethrottleOutbound/throttleTimeDivisor)) && TextureOutgoingPacketQueue.Count > 0) | 289 | if (m_textureBytesSent <= ((int)(m_texturethrottleOutbound/m_throttleTimeDivisor)) && m_textureOutgoingPacketQueue.Count > 0) |
280 | { | 290 | { |
281 | QueItem qpack = TextureOutgoingPacketQueue.Dequeue(); | 291 | QueItem qpack = m_textureOutgoingPacketQueue.Dequeue(); |
282 | 292 | ||
283 | PacketQueue.Enqueue(qpack); | 293 | m_packetQueue.Enqueue(qpack); |
284 | bytesSent += qpack.Packet.ToBytes().Length; | 294 | m_bytesSent += qpack.Packet.ToBytes().Length; |
285 | TextureBytesSent += qpack.Packet.ToBytes().Length; | 295 | m_textureBytesSent += qpack.Packet.ToBytes().Length; |
286 | } | 296 | } |
287 | if (AssetBytesSent <= ((int)(AssetthrottleOutbound/throttleTimeDivisor)) && AssetOutgoingPacketQueue.Count > 0) | 297 | if (m_assetBytesSent <= ((int)(m_assetthrottleOutbound/m_throttleTimeDivisor)) && m_assetOutgoingPacketQueue.Count > 0) |
288 | { | 298 | { |
289 | QueItem qpack = AssetOutgoingPacketQueue.Dequeue(); | 299 | QueItem qpack = m_assetOutgoingPacketQueue.Dequeue(); |
290 | 300 | ||
291 | PacketQueue.Enqueue(qpack); | 301 | m_packetQueue.Enqueue(qpack); |
292 | bytesSent += qpack.Packet.ToBytes().Length; | 302 | m_bytesSent += qpack.Packet.ToBytes().Length; |
293 | AssetBytesSent += qpack.Packet.ToBytes().Length; | 303 | m_assetBytesSent += qpack.Packet.ToBytes().Length; |
294 | } | 304 | } |
295 | 305 | ||
296 | } | 306 | } |
307 | } | ||
308 | |||
309 | private int ProcessQueue(Queue<QueItem> queue) | ||
310 | { | ||
311 | if (queue.Count > 0) | ||
312 | { | ||
313 | QueItem qpack = queue.Dequeue(); | ||
314 | |||
315 | m_packetQueue.Enqueue(qpack); | ||
316 | int packLength = qpack.Packet.ToBytes().Length; | ||
317 | |||
318 | m_bytesSent += packLength; | ||
319 | return packLength; | ||
320 | } | ||
297 | 321 | ||
322 | return 0; | ||
323 | } | ||
324 | |||
325 | private bool TimeToDequeue(int bytesSent, int outboundThrottle) | ||
326 | { | ||
327 | return bytesSent <= ((int)(outboundThrottle / m_throttleTimeDivisor)); | ||
298 | } | 328 | } |
299 | 329 | ||
300 | public LLUUID SessionId | 330 | public LLUUID SessionId |
@@ -311,7 +341,7 @@ namespace OpenSim.Region.ClientStack | |||
311 | 341 | ||
312 | public void Close() | 342 | public void Close() |
313 | { | 343 | { |
314 | clientPingTimer.Stop(); | 344 | m_clientPingTimer.Stop(); |
315 | 345 | ||
316 | m_scene.RemoveClient(AgentId); | 346 | m_scene.RemoveClient(AgentId); |
317 | 347 | ||
@@ -333,7 +363,7 @@ namespace OpenSim.Region.ClientStack | |||
333 | } | 363 | } |
334 | public void Stop() | 364 | public void Stop() |
335 | { | 365 | { |
336 | clientPingTimer.Stop(); | 366 | m_clientPingTimer.Stop(); |
337 | 367 | ||
338 | libsecondlife.Packets.DisableSimulatorPacket disable = new libsecondlife.Packets.DisableSimulatorPacket(); | 368 | libsecondlife.Packets.DisableSimulatorPacket disable = new libsecondlife.Packets.DisableSimulatorPacket(); |
339 | OutPacket(disable, ThrottleOutPacketType.Task); | 369 | OutPacket(disable, ThrottleOutPacketType.Task); |
@@ -434,7 +464,7 @@ namespace OpenSim.Region.ClientStack | |||
434 | MainLog.Instance.Verbose("CLIENT", "Entered loop"); | 464 | MainLog.Instance.Verbose("CLIENT", "Entered loop"); |
435 | while (true) | 465 | while (true) |
436 | { | 466 | { |
437 | QueItem nextPacket = PacketQueue.Dequeue(); | 467 | QueItem nextPacket = m_packetQueue.Dequeue(); |
438 | if (nextPacket.Incoming) | 468 | if (nextPacket.Incoming) |
439 | { | 469 | { |
440 | queuedLast = false; | 470 | queuedLast = false; |
@@ -442,7 +472,7 @@ namespace OpenSim.Region.ClientStack | |||
442 | //is a incoming packet | 472 | //is a incoming packet |
443 | if (nextPacket.Packet.Type != PacketType.AgentUpdate) | 473 | if (nextPacket.Packet.Type != PacketType.AgentUpdate) |
444 | { | 474 | { |
445 | packetsReceived++; | 475 | m_packetsReceived++; |
446 | } | 476 | } |
447 | DebugPacket("IN", nextPacket.Packet); | 477 | DebugPacket("IN", nextPacket.Packet); |
448 | ProcessInPacket(nextPacket.Packet); | 478 | ProcessInPacket(nextPacket.Packet); |
@@ -450,9 +480,9 @@ namespace OpenSim.Region.ClientStack | |||
450 | else | 480 | else |
451 | { | 481 | { |
452 | // Throw it back on the queue if it's going to cause us to flood the client | 482 | // Throw it back on the queue if it's going to cause us to flood the client |
453 | if (bytesSent > throttleOutboundMax) | 483 | if (m_bytesSent > m_throttleOutboundMax) |
454 | { | 484 | { |
455 | PacketQueue.Enqueue(nextPacket); | 485 | m_packetQueue.Enqueue(nextPacket); |
456 | MainLog.Instance.Verbose("THROTTLE", "Client over throttle limit, requeuing packet"); | 486 | MainLog.Instance.Verbose("THROTTLE", "Client over throttle limit, requeuing packet"); |
457 | 487 | ||
458 | if (queuedLast) | 488 | if (queuedLast) |
@@ -471,7 +501,7 @@ namespace OpenSim.Region.ClientStack | |||
471 | 501 | ||
472 | //Don't throttle AvatarPickerReplies!, they return a null .ToBytes()! | 502 | //Don't throttle AvatarPickerReplies!, they return a null .ToBytes()! |
473 | if (nextPacket.Packet.Type != PacketType.AvatarPickerReply) | 503 | if (nextPacket.Packet.Type != PacketType.AvatarPickerReply) |
474 | bytesSent += nextPacket.Packet.ToBytes().Length; | 504 | m_bytesSent += nextPacket.Packet.ToBytes().Length; |
475 | 505 | ||
476 | 506 | ||
477 | //is a out going packet | 507 | //is a out going packet |
@@ -487,10 +517,10 @@ namespace OpenSim.Region.ClientStack | |||
487 | 517 | ||
488 | protected void CheckClientConnectivity(object sender, ElapsedEventArgs e) | 518 | protected void CheckClientConnectivity(object sender, ElapsedEventArgs e) |
489 | { | 519 | { |
490 | if (packetsReceived == lastPacketsReceived) | 520 | if (m_packetsReceived == m_lastPacketsReceived) |
491 | { | 521 | { |
492 | probesWithNoIngressPackets++; | 522 | m_probesWithNoIngressPackets++; |
493 | if (probesWithNoIngressPackets > 30) | 523 | if (m_probesWithNoIngressPackets > 30) |
494 | { | 524 | { |
495 | if (OnConnectionClosed != null) | 525 | if (OnConnectionClosed != null) |
496 | { | 526 | { |
@@ -506,8 +536,8 @@ namespace OpenSim.Region.ClientStack | |||
506 | else | 536 | else |
507 | { | 537 | { |
508 | // Something received in the meantime - we can reset the counters | 538 | // Something received in the meantime - we can reset the counters |
509 | probesWithNoIngressPackets = 0; | 539 | m_probesWithNoIngressPackets = 0; |
510 | lastPacketsReceived = packetsReceived; | 540 | m_lastPacketsReceived = m_packetsReceived; |
511 | } | 541 | } |
512 | } | 542 | } |
513 | 543 | ||
@@ -515,9 +545,9 @@ namespace OpenSim.Region.ClientStack | |||
515 | 545 | ||
516 | protected virtual void InitNewClient() | 546 | protected virtual void InitNewClient() |
517 | { | 547 | { |
518 | clientPingTimer = new Timer(5000); | 548 | m_clientPingTimer = new Timer(5000); |
519 | clientPingTimer.Elapsed += new ElapsedEventHandler(CheckClientConnectivity); | 549 | m_clientPingTimer.Elapsed += new ElapsedEventHandler(CheckClientConnectivity); |
520 | clientPingTimer.Enabled = true; | 550 | m_clientPingTimer.Enabled = true; |
521 | 551 | ||
522 | MainLog.Instance.Verbose("CLIENT", "Adding viewer agent to scene"); | 552 | MainLog.Instance.Verbose("CLIENT", "Adding viewer agent to scene"); |
523 | m_scene.AddNewClient(this, true); | 553 | m_scene.AddNewClient(this, true); |
@@ -2203,20 +2233,20 @@ namespace OpenSim.Region.ClientStack | |||
2203 | } | 2233 | } |
2204 | 2234 | ||
2205 | // Previously ClientView.PacketQueue | 2235 | // Previously ClientView.PacketQueue |
2206 | protected BlockingQueue<QueItem> PacketQueue; | 2236 | protected BlockingQueue<QueItem> m_packetQueue; |
2207 | 2237 | ||
2208 | protected Queue<QueItem> IncomingPacketQueue; | 2238 | protected Queue<QueItem> m_incomingPacketQueue; |
2209 | protected Queue<QueItem> OutgoingPacketQueue; | 2239 | protected Queue<QueItem> m_outgoingPacketQueue; |
2210 | protected Queue<QueItem> ResendOutgoingPacketQueue; | 2240 | protected Queue<QueItem> m_resendOutgoingPacketQueue; |
2211 | protected Queue<QueItem> LandOutgoingPacketQueue; | 2241 | protected Queue<QueItem> m_landOutgoingPacketQueue; |
2212 | protected Queue<QueItem> WindOutgoingPacketQueue; | 2242 | protected Queue<QueItem> m_windOutgoingPacketQueue; |
2213 | protected Queue<QueItem> CloudOutgoingPacketQueue; | 2243 | protected Queue<QueItem> m_cloudOutgoingPacketQueue; |
2214 | protected Queue<QueItem> TaskOutgoingPacketQueue; | 2244 | protected Queue<QueItem> m_taskOutgoingPacketQueue; |
2215 | protected Queue<QueItem> TextureOutgoingPacketQueue; | 2245 | protected Queue<QueItem> m_textureOutgoingPacketQueue; |
2216 | protected Queue<QueItem> AssetOutgoingPacketQueue; | 2246 | protected Queue<QueItem> m_assetOutgoingPacketQueue; |
2217 | 2247 | ||
2218 | protected Dictionary<uint, uint> PendingAcks = new Dictionary<uint, uint>(); | 2248 | protected Dictionary<uint, uint> m_pendingAcks = new Dictionary<uint, uint>(); |
2219 | protected Dictionary<uint, Packet> NeedAck = new Dictionary<uint, Packet>(); | 2249 | protected Dictionary<uint, Packet> m_needAck = new Dictionary<uint, Packet>(); |
2220 | 2250 | ||
2221 | protected Timer AckTimer; | 2251 | protected Timer AckTimer; |
2222 | protected uint Sequence = 0; | 2252 | protected uint Sequence = 0; |
@@ -2258,13 +2288,13 @@ namespace OpenSim.Region.ClientStack | |||
2258 | 2288 | ||
2259 | protected void AddAck(Packet Pack) | 2289 | protected void AddAck(Packet Pack) |
2260 | { | 2290 | { |
2261 | lock (NeedAck) | 2291 | lock (m_needAck) |
2262 | { | 2292 | { |
2263 | if (!NeedAck.ContainsKey(Pack.Header.Sequence)) | 2293 | if (!m_needAck.ContainsKey(Pack.Header.Sequence)) |
2264 | { | 2294 | { |
2265 | try | 2295 | try |
2266 | { | 2296 | { |
2267 | NeedAck.Add(Pack.Header.Sequence, Pack); | 2297 | m_needAck.Add(Pack.Header.Sequence, Pack); |
2268 | } | 2298 | } |
2269 | catch (Exception e) // HACKY | 2299 | catch (Exception e) // HACKY |
2270 | { | 2300 | { |
@@ -2278,7 +2308,7 @@ namespace OpenSim.Region.ClientStack | |||
2278 | else | 2308 | else |
2279 | { | 2309 | { |
2280 | // Client.Log("Attempted to add a duplicate sequence number (" + | 2310 | // Client.Log("Attempted to add a duplicate sequence number (" + |
2281 | // packet.Header.Sequence + ") to the NeedAck dictionary for packet type " + | 2311 | // packet.Header.Sequence + ") to the m_needAck dictionary for packet type " + |
2282 | // packet.Type.ToString(), Helpers.LogLevel.Warning); | 2312 | // packet.Type.ToString(), Helpers.LogLevel.Warning); |
2283 | } | 2313 | } |
2284 | } | 2314 | } |
@@ -2287,21 +2317,21 @@ namespace OpenSim.Region.ClientStack | |||
2287 | protected virtual void SetPendingAcks(ref Packet Pack) | 2317 | protected virtual void SetPendingAcks(ref Packet Pack) |
2288 | { | 2318 | { |
2289 | // Append any ACKs that need to be sent out to this packet | 2319 | // Append any ACKs that need to be sent out to this packet |
2290 | lock (PendingAcks) | 2320 | lock (m_pendingAcks) |
2291 | { | 2321 | { |
2292 | // TODO: If we are over MAX_APPENDED_ACKS we should drain off some of these | 2322 | // TODO: If we are over MAX_APPENDED_ACKS we should drain off some of these |
2293 | if (PendingAcks.Count > 0 && PendingAcks.Count < MAX_APPENDED_ACKS) | 2323 | if (m_pendingAcks.Count > 0 && m_pendingAcks.Count < MAX_APPENDED_ACKS) |
2294 | { | 2324 | { |
2295 | Pack.Header.AckList = new uint[PendingAcks.Count]; | 2325 | Pack.Header.AckList = new uint[m_pendingAcks.Count]; |
2296 | int i = 0; | 2326 | int i = 0; |
2297 | 2327 | ||
2298 | foreach (uint ack in PendingAcks.Values) | 2328 | foreach (uint ack in m_pendingAcks.Values) |
2299 | { | 2329 | { |
2300 | Pack.Header.AckList[i] = ack; | 2330 | Pack.Header.AckList[i] = ack; |
2301 | i++; | 2331 | i++; |
2302 | } | 2332 | } |
2303 | 2333 | ||
2304 | PendingAcks.Clear(); | 2334 | m_pendingAcks.Clear(); |
2305 | Pack.Header.AppendedAcks = true; | 2335 | Pack.Header.AppendedAcks = true; |
2306 | } | 2336 | } |
2307 | } | 2337 | } |
@@ -2357,11 +2387,11 @@ namespace OpenSim.Region.ClientStack | |||
2357 | // Handle appended ACKs | 2387 | // Handle appended ACKs |
2358 | if (NewPack.Header.AppendedAcks) | 2388 | if (NewPack.Header.AppendedAcks) |
2359 | { | 2389 | { |
2360 | lock (NeedAck) | 2390 | lock (m_needAck) |
2361 | { | 2391 | { |
2362 | foreach (uint ack in NewPack.Header.AckList) | 2392 | foreach (uint ack in NewPack.Header.AckList) |
2363 | { | 2393 | { |
2364 | NeedAck.Remove(ack); | 2394 | m_needAck.Remove(ack); |
2365 | } | 2395 | } |
2366 | } | 2396 | } |
2367 | } | 2397 | } |
@@ -2371,11 +2401,11 @@ namespace OpenSim.Region.ClientStack | |||
2371 | { | 2401 | { |
2372 | PacketAckPacket ackPacket = (PacketAckPacket) NewPack; | 2402 | PacketAckPacket ackPacket = (PacketAckPacket) NewPack; |
2373 | 2403 | ||
2374 | lock (NeedAck) | 2404 | lock (m_needAck) |
2375 | { | 2405 | { |
2376 | foreach (PacketAckPacket.PacketsBlock block in ackPacket.Packets) | 2406 | foreach (PacketAckPacket.PacketsBlock block in ackPacket.Packets) |
2377 | { | 2407 | { |
2378 | NeedAck.Remove(block.ID); | 2408 | m_needAck.Remove(block.ID); |
2379 | } | 2409 | } |
2380 | } | 2410 | } |
2381 | } | 2411 | } |
@@ -2392,7 +2422,7 @@ namespace OpenSim.Region.ClientStack | |||
2392 | QueItem item = new QueItem(); | 2422 | QueItem item = new QueItem(); |
2393 | item.Packet = NewPack; | 2423 | item.Packet = NewPack; |
2394 | item.Incoming = true; | 2424 | item.Incoming = true; |
2395 | PacketQueue.Enqueue(item); | 2425 | m_packetQueue.Enqueue(item); |
2396 | } | 2426 | } |
2397 | } | 2427 | } |
2398 | 2428 | ||
@@ -2404,11 +2434,11 @@ namespace OpenSim.Region.ClientStack | |||
2404 | // wait for the timer to fire to put things into the | 2434 | // wait for the timer to fire to put things into the |
2405 | // output queue | 2435 | // output queue |
2406 | 2436 | ||
2407 | if((q.Count == 0) && (TypeBytesSent <= ((int)(Throttle / throttleTimeDivisor)))) | 2437 | if((q.Count == 0) && (TypeBytesSent <= ((int)(Throttle / m_throttleTimeDivisor)))) |
2408 | { | 2438 | { |
2409 | bytesSent += item.Packet.ToBytes().Length; | 2439 | m_bytesSent += item.Packet.ToBytes().Length; |
2410 | TypeBytesSent += item.Packet.ToBytes().Length; | 2440 | TypeBytesSent += item.Packet.ToBytes().Length; |
2411 | PacketQueue.Enqueue(item); | 2441 | m_packetQueue.Enqueue(item); |
2412 | } | 2442 | } |
2413 | else | 2443 | else |
2414 | { | 2444 | { |
@@ -2428,34 +2458,34 @@ namespace OpenSim.Region.ClientStack | |||
2428 | switch (throttlePacketType) | 2458 | switch (throttlePacketType) |
2429 | { | 2459 | { |
2430 | case ThrottleOutPacketType.Resend: | 2460 | case ThrottleOutPacketType.Resend: |
2431 | ThrottleCheck(ref ResendBytesSent, ResendthrottleOutbound, ref ResendOutgoingPacketQueue, item); | 2461 | ThrottleCheck(ref m_resendBytesSent, m_resendthrottleOutbound, ref m_resendOutgoingPacketQueue, item); |
2432 | break; | 2462 | break; |
2433 | case ThrottleOutPacketType.Texture: | 2463 | case ThrottleOutPacketType.Texture: |
2434 | ThrottleCheck(ref TextureBytesSent, TexturethrottleOutbound, ref TextureOutgoingPacketQueue, item); | 2464 | ThrottleCheck(ref m_textureBytesSent, m_texturethrottleOutbound, ref m_textureOutgoingPacketQueue, item); |
2435 | break; | 2465 | break; |
2436 | case ThrottleOutPacketType.Task: | 2466 | case ThrottleOutPacketType.Task: |
2437 | ThrottleCheck(ref TaskBytesSent, TaskthrottleOutbound, ref TaskOutgoingPacketQueue, item); | 2467 | ThrottleCheck(ref m_taskBytesSent, m_taskthrottleOutbound, ref m_taskOutgoingPacketQueue, item); |
2438 | break; | 2468 | break; |
2439 | case ThrottleOutPacketType.Land: | 2469 | case ThrottleOutPacketType.Land: |
2440 | ThrottleCheck(ref LandBytesSent, LandthrottleOutbound, ref LandOutgoingPacketQueue, item); | 2470 | ThrottleCheck(ref m_landBytesSent, m_landthrottleOutbound, ref m_landOutgoingPacketQueue, item); |
2441 | break; | 2471 | break; |
2442 | case ThrottleOutPacketType.Asset: | 2472 | case ThrottleOutPacketType.Asset: |
2443 | ThrottleCheck(ref AssetBytesSent, AssetthrottleOutbound, ref AssetOutgoingPacketQueue, item); | 2473 | ThrottleCheck(ref m_assetBytesSent, m_assetthrottleOutbound, ref m_assetOutgoingPacketQueue, item); |
2444 | break; | 2474 | break; |
2445 | case ThrottleOutPacketType.Cloud: | 2475 | case ThrottleOutPacketType.Cloud: |
2446 | ThrottleCheck(ref CloudBytesSent, CloudthrottleOutbound, ref CloudOutgoingPacketQueue, item); | 2476 | ThrottleCheck(ref m_cloudBytesSent, m_cloudthrottleOutbound, ref m_cloudOutgoingPacketQueue, item); |
2447 | break; | 2477 | break; |
2448 | case ThrottleOutPacketType.Wind: | 2478 | case ThrottleOutPacketType.Wind: |
2449 | ThrottleCheck(ref WindBytesSent, WindthrottleOutbound, ref WindOutgoingPacketQueue, item); | 2479 | ThrottleCheck(ref m_windBytesSent, m_windthrottleOutbound, ref m_windOutgoingPacketQueue, item); |
2450 | break; | 2480 | break; |
2451 | 2481 | ||
2452 | default: | 2482 | default: |
2453 | // Acknowledgements and other such stuff should go directly to the blocking Queue | 2483 | // Acknowledgements and other such stuff should go directly to the blocking Queue |
2454 | // Throttling them may and likely 'will' be problematic | 2484 | // Throttling them may and likely 'will' be problematic |
2455 | PacketQueue.Enqueue(item); | 2485 | m_packetQueue.Enqueue(item); |
2456 | break; | 2486 | break; |
2457 | } | 2487 | } |
2458 | //OutgoingPacketQueue.Enqueue(item); | 2488 | //m_outgoingPacketQueue.Enqueue(item); |
2459 | } | 2489 | } |
2460 | 2490 | ||
2461 | # region Low Level Packet Methods | 2491 | # region Low Level Packet Methods |
@@ -2475,10 +2505,10 @@ namespace OpenSim.Region.ClientStack | |||
2475 | /* | 2505 | /* |
2476 | if (Pack.Header.Reliable) | 2506 | if (Pack.Header.Reliable) |
2477 | { | 2507 | { |
2478 | lock (PendingAcks) | 2508 | lock (m_pendingAcks) |
2479 | { | 2509 | { |
2480 | uint sequence = (uint)Pack.Header.Sequence; | 2510 | uint sequence = (uint)Pack.Header.Sequence; |
2481 | if (!PendingAcks.ContainsKey(sequence)) { PendingAcks[sequence] = sequence; } | 2511 | if (!m_pendingAcks.ContainsKey(sequence)) { m_pendingAcks[sequence] = sequence; } |
2482 | } | 2512 | } |
2483 | }*/ | 2513 | }*/ |
2484 | } | 2514 | } |
@@ -2487,9 +2517,9 @@ namespace OpenSim.Region.ClientStack | |||
2487 | { | 2517 | { |
2488 | int now = System.Environment.TickCount; | 2518 | int now = System.Environment.TickCount; |
2489 | 2519 | ||
2490 | lock (NeedAck) | 2520 | lock (m_needAck) |
2491 | { | 2521 | { |
2492 | foreach (Packet packet in NeedAck.Values) | 2522 | foreach (Packet packet in m_needAck.Values) |
2493 | { | 2523 | { |
2494 | if ((now - packet.TickCount > RESEND_TIMEOUT) && (!packet.Header.Resent)) | 2524 | if ((now - packet.TickCount > RESEND_TIMEOUT) && (!packet.Header.Resent)) |
2495 | { | 2525 | { |
@@ -2505,11 +2535,11 @@ namespace OpenSim.Region.ClientStack | |||
2505 | 2535 | ||
2506 | protected void SendAcks() | 2536 | protected void SendAcks() |
2507 | { | 2537 | { |
2508 | lock (PendingAcks) | 2538 | lock (m_pendingAcks) |
2509 | { | 2539 | { |
2510 | if (PendingAcks.Count > 0) | 2540 | if (m_pendingAcks.Count > 0) |
2511 | { | 2541 | { |
2512 | if (PendingAcks.Count > 250) | 2542 | if (m_pendingAcks.Count > 250) |
2513 | { | 2543 | { |
2514 | // FIXME: Handle the odd case where we have too many pending ACKs queued up | 2544 | // FIXME: Handle the odd case where we have too many pending ACKs queued up |
2515 | MainLog.Instance.Verbose("NETWORK", "Too many ACKs queued up!"); | 2545 | MainLog.Instance.Verbose("NETWORK", "Too many ACKs queued up!"); |
@@ -2520,9 +2550,9 @@ namespace OpenSim.Region.ClientStack | |||
2520 | 2550 | ||
2521 | int i = 0; | 2551 | int i = 0; |
2522 | PacketAckPacket acks = new PacketAckPacket(); | 2552 | PacketAckPacket acks = new PacketAckPacket(); |
2523 | acks.Packets = new PacketAckPacket.PacketsBlock[PendingAcks.Count]; | 2553 | acks.Packets = new PacketAckPacket.PacketsBlock[m_pendingAcks.Count]; |
2524 | 2554 | ||
2525 | foreach (uint ack in PendingAcks.Values) | 2555 | foreach (uint ack in m_pendingAcks.Values) |
2526 | { | 2556 | { |
2527 | acks.Packets[i] = new PacketAckPacket.PacketsBlock(); | 2557 | acks.Packets[i] = new PacketAckPacket.PacketsBlock(); |
2528 | acks.Packets[i].ID = ack; | 2558 | acks.Packets[i].ID = ack; |
@@ -2532,7 +2562,7 @@ namespace OpenSim.Region.ClientStack | |||
2532 | acks.Header.Reliable = false; | 2562 | acks.Header.Reliable = false; |
2533 | OutPacket(acks, ThrottleOutPacketType.Unknown); | 2563 | OutPacket(acks, ThrottleOutPacketType.Unknown); |
2534 | 2564 | ||
2535 | PendingAcks.Clear(); | 2565 | m_pendingAcks.Clear(); |
2536 | } | 2566 | } |
2537 | } | 2567 | } |
2538 | } | 2568 | } |
@@ -3388,7 +3418,7 @@ namespace OpenSim.Region.ClientStack | |||
3388 | // If the client didn't send acceptable values.... | 3418 | // If the client didn't send acceptable values.... |
3389 | // Scale the clients values down until they are acceptable. | 3419 | // Scale the clients values down until they are acceptable. |
3390 | 3420 | ||
3391 | if (tall <= throttleOutboundMax) | 3421 | if (tall <= m_throttleOutboundMax) |
3392 | { | 3422 | { |
3393 | // Sanity | 3423 | // Sanity |
3394 | // Making sure the client sends sane values | 3424 | // Making sure the client sends sane values |
@@ -3397,61 +3427,61 @@ namespace OpenSim.Region.ClientStack | |||
3397 | // Then Check Min of type | 3427 | // Then Check Min of type |
3398 | 3428 | ||
3399 | // Resend throttle | 3429 | // Resend throttle |
3400 | if (tResend <= ResendthrottleMAX) | 3430 | if (tResend <= m_resendthrottleMAX) |
3401 | ResendthrottleOutbound = tResend; | 3431 | m_resendthrottleOutbound = tResend; |
3402 | 3432 | ||
3403 | if (tResend < ResendthrottleMin) | 3433 | if (tResend < m_resendthrottleMin) |
3404 | ResendthrottleOutbound = ResendthrottleMin; | 3434 | m_resendthrottleOutbound = m_resendthrottleMin; |
3405 | 3435 | ||
3406 | // Land throttle | 3436 | // Land throttle |
3407 | if (tLand <= LandthrottleMax) | 3437 | if (tLand <= m_landthrottleMax) |
3408 | LandthrottleOutbound = tLand; | 3438 | m_landthrottleOutbound = tLand; |
3409 | 3439 | ||
3410 | if (tLand < LandthrottleMin) | 3440 | if (tLand < m_landthrottleMin) |
3411 | LandthrottleOutbound = LandthrottleMin; | 3441 | m_landthrottleOutbound = m_landthrottleMin; |
3412 | 3442 | ||
3413 | // Wind throttle | 3443 | // Wind throttle |
3414 | if (tWind <= WindthrottleMax) | 3444 | if (tWind <= m_windthrottleMax) |
3415 | WindthrottleOutbound = tWind; | 3445 | m_windthrottleOutbound = tWind; |
3416 | 3446 | ||
3417 | if (tWind < WindthrottleMin) | 3447 | if (tWind < m_windthrottleMin) |
3418 | WindthrottleOutbound = WindthrottleMin; | 3448 | m_windthrottleOutbound = m_windthrottleMin; |
3419 | 3449 | ||
3420 | // Cloud throttle | 3450 | // Cloud throttle |
3421 | if (tCloud <= CloudthrottleMax) | 3451 | if (tCloud <= m_cloudthrottleMax) |
3422 | CloudthrottleOutbound = tCloud; | 3452 | m_cloudthrottleOutbound = tCloud; |
3423 | 3453 | ||
3424 | if (tCloud < CloudthrottleMin) | 3454 | if (tCloud < m_cloudthrottleMin) |
3425 | CloudthrottleOutbound = CloudthrottleMin; | 3455 | m_cloudthrottleOutbound = m_cloudthrottleMin; |
3426 | 3456 | ||
3427 | // Task throttle | 3457 | // Task throttle |
3428 | if (tTask <= TaskthrottleMax) | 3458 | if (tTask <= m_taskthrottleMax) |
3429 | TaskthrottleOutbound = tTask; | 3459 | m_taskthrottleOutbound = tTask; |
3430 | 3460 | ||
3431 | if (tTask < TaskthrottleMin) | 3461 | if (tTask < m_taskthrottleMin) |
3432 | TaskthrottleOutbound = TaskthrottleMin; | 3462 | m_taskthrottleOutbound = m_taskthrottleMin; |
3433 | 3463 | ||
3434 | // Texture throttle | 3464 | // Texture throttle |
3435 | if (tTexture <= TexturethrottleMax) | 3465 | if (tTexture <= m_texturethrottleMax) |
3436 | TexturethrottleOutbound = tTexture; | 3466 | m_texturethrottleOutbound = tTexture; |
3437 | 3467 | ||
3438 | if (tTexture < TexturethrottleMin) | 3468 | if (tTexture < m_texturethrottleMin) |
3439 | TexturethrottleOutbound = TexturethrottleMin; | 3469 | m_texturethrottleOutbound = m_texturethrottleMin; |
3440 | 3470 | ||
3441 | //Asset throttle | 3471 | //Asset throttle |
3442 | if (tAsset <= AssetthrottleMax) | 3472 | if (tAsset <= m_assetthrottleMax) |
3443 | AssetthrottleOutbound = tAsset; | 3473 | m_assetthrottleOutbound = tAsset; |
3444 | 3474 | ||
3445 | if (tAsset < AssetthrottleMin) | 3475 | if (tAsset < m_assetthrottleMin) |
3446 | AssetthrottleOutbound = AssetthrottleMin; | 3476 | m_assetthrottleOutbound = m_assetthrottleMin; |
3447 | 3477 | ||
3448 | /* MainLog.Instance.Verbose("THROTTLE", "Using:resendbytes=" + ResendthrottleOutbound + | 3478 | /* MainLog.Instance.Verbose("THROTTLE", "Using:resendbytes=" + m_resendthrottleOutbound + |
3449 | " landbytes=" + LandthrottleOutbound + | 3479 | " landbytes=" + m_landthrottleOutbound + |
3450 | " windbytes=" + WindthrottleOutbound + | 3480 | " windbytes=" + m_windthrottleOutbound + |
3451 | " cloudbytes=" + CloudthrottleOutbound + | 3481 | " cloudbytes=" + m_cloudthrottleOutbound + |
3452 | " taskbytes=" + TaskthrottleOutbound + | 3482 | " taskbytes=" + m_taskthrottleOutbound + |
3453 | " texturebytes=" + TexturethrottleOutbound + | 3483 | " texturebytes=" + m_texturethrottleOutbound + |
3454 | " Assetbytes=" + AssetthrottleOutbound + | 3484 | " Assetbytes=" + m_assetthrottleOutbound + |
3455 | " Allbytes=" + tall); | 3485 | " Allbytes=" + tall); |
3456 | */ | 3486 | */ |
3457 | } | 3487 | } |
@@ -3471,23 +3501,23 @@ namespace OpenSim.Region.ClientStack | |||
3471 | // it's client recommended level (won't scale it down) | 3501 | // it's client recommended level (won't scale it down) |
3472 | // unless it's beyond sane values itself. | 3502 | // unless it's beyond sane values itself. |
3473 | 3503 | ||
3474 | if (tResend <= ResendthrottleMAX) | 3504 | if (tResend <= m_resendthrottleMAX) |
3475 | { | 3505 | { |
3476 | // This is nexted because we only want to re-set the values | 3506 | // This is nexted because we only want to re-set the values |
3477 | // the packet throttler uses once. | 3507 | // the packet throttler uses once. |
3478 | 3508 | ||
3479 | if (tResend >= ResendthrottleMin) | 3509 | if (tResend >= m_resendthrottleMin) |
3480 | { | 3510 | { |
3481 | ResendthrottleOutbound = tResend; | 3511 | m_resendthrottleOutbound = tResend; |
3482 | } | 3512 | } |
3483 | else | 3513 | else |
3484 | { | 3514 | { |
3485 | ResendthrottleOutbound = ResendthrottleMin; | 3515 | m_resendthrottleOutbound = m_resendthrottleMin; |
3486 | } | 3516 | } |
3487 | } | 3517 | } |
3488 | else | 3518 | else |
3489 | { | 3519 | { |
3490 | ResendthrottleOutbound = ResendthrottleMAX; | 3520 | m_resendthrottleOutbound = m_resendthrottleMAX; |
3491 | } | 3521 | } |
3492 | 3522 | ||
3493 | 3523 | ||
@@ -3502,12 +3532,12 @@ namespace OpenSim.Region.ClientStack | |||
3502 | // Okay.. now we've got the percentages of total communication. | 3532 | // Okay.. now we've got the percentages of total communication. |
3503 | // Apply them to a new max total | 3533 | // Apply them to a new max total |
3504 | 3534 | ||
3505 | int tLandResult = (int)(LandPercent * throttleOutboundMax); | 3535 | int tLandResult = (int)(LandPercent * m_throttleOutboundMax); |
3506 | int tWindResult = (int)(WindPercent * throttleOutboundMax); | 3536 | int tWindResult = (int)(WindPercent * m_throttleOutboundMax); |
3507 | int tCloudResult = (int)(CloudPercent * throttleOutboundMax); | 3537 | int tCloudResult = (int)(CloudPercent * m_throttleOutboundMax); |
3508 | int tTaskResult = (int)(TaskPercent * throttleOutboundMax); | 3538 | int tTaskResult = (int)(TaskPercent * m_throttleOutboundMax); |
3509 | int tTextureResult = (int)(TexturePercent * throttleOutboundMax); | 3539 | int tTextureResult = (int)(TexturePercent * m_throttleOutboundMax); |
3510 | int tAssetResult = (int)(AssetPercent * throttleOutboundMax); | 3540 | int tAssetResult = (int)(AssetPercent * m_throttleOutboundMax); |
3511 | 3541 | ||
3512 | // Now we have to check our scaled values for sanity | 3542 | // Now we have to check our scaled values for sanity |
3513 | 3543 | ||
@@ -3515,54 +3545,54 @@ namespace OpenSim.Region.ClientStack | |||
3515 | // Then Check Min of type | 3545 | // Then Check Min of type |
3516 | 3546 | ||
3517 | // Land throttle | 3547 | // Land throttle |
3518 | if (tLandResult <= LandthrottleMax) | 3548 | if (tLandResult <= m_landthrottleMax) |
3519 | LandthrottleOutbound = tLandResult; | 3549 | m_landthrottleOutbound = tLandResult; |
3520 | 3550 | ||
3521 | if (tLandResult < LandthrottleMin) | 3551 | if (tLandResult < m_landthrottleMin) |
3522 | LandthrottleOutbound = LandthrottleMin; | 3552 | m_landthrottleOutbound = m_landthrottleMin; |
3523 | 3553 | ||
3524 | // Wind throttle | 3554 | // Wind throttle |
3525 | if (tWindResult <= WindthrottleMax) | 3555 | if (tWindResult <= m_windthrottleMax) |
3526 | WindthrottleOutbound = tWindResult; | 3556 | m_windthrottleOutbound = tWindResult; |
3527 | 3557 | ||
3528 | if (tWindResult < WindthrottleMin) | 3558 | if (tWindResult < m_windthrottleMin) |
3529 | WindthrottleOutbound = WindthrottleMin; | 3559 | m_windthrottleOutbound = m_windthrottleMin; |
3530 | 3560 | ||
3531 | // Cloud throttle | 3561 | // Cloud throttle |
3532 | if (tCloudResult <= CloudthrottleMax) | 3562 | if (tCloudResult <= m_cloudthrottleMax) |
3533 | CloudthrottleOutbound = tCloudResult; | 3563 | m_cloudthrottleOutbound = tCloudResult; |
3534 | 3564 | ||
3535 | if (tCloudResult < CloudthrottleMin) | 3565 | if (tCloudResult < m_cloudthrottleMin) |
3536 | CloudthrottleOutbound = CloudthrottleMin; | 3566 | m_cloudthrottleOutbound = m_cloudthrottleMin; |
3537 | 3567 | ||
3538 | // Task throttle | 3568 | // Task throttle |
3539 | if (tTaskResult <= TaskthrottleMax) | 3569 | if (tTaskResult <= m_taskthrottleMax) |
3540 | TaskthrottleOutbound = tTaskResult; | 3570 | m_taskthrottleOutbound = tTaskResult; |
3541 | 3571 | ||
3542 | if (tTaskResult < TaskthrottleMin) | 3572 | if (tTaskResult < m_taskthrottleMin) |
3543 | TaskthrottleOutbound = TaskthrottleMin; | 3573 | m_taskthrottleOutbound = m_taskthrottleMin; |
3544 | 3574 | ||
3545 | // Texture throttle | 3575 | // Texture throttle |
3546 | if (tTextureResult <= TexturethrottleMax) | 3576 | if (tTextureResult <= m_texturethrottleMax) |
3547 | TexturethrottleOutbound = tTextureResult; | 3577 | m_texturethrottleOutbound = tTextureResult; |
3548 | 3578 | ||
3549 | if (tTextureResult < TexturethrottleMin) | 3579 | if (tTextureResult < m_texturethrottleMin) |
3550 | TexturethrottleOutbound = TexturethrottleMin; | 3580 | m_texturethrottleOutbound = m_texturethrottleMin; |
3551 | 3581 | ||
3552 | //Asset throttle | 3582 | //Asset throttle |
3553 | if (tAssetResult <= AssetthrottleMax) | 3583 | if (tAssetResult <= m_assetthrottleMax) |
3554 | AssetthrottleOutbound = tAssetResult; | 3584 | m_assetthrottleOutbound = tAssetResult; |
3555 | 3585 | ||
3556 | if (tAssetResult < AssetthrottleMin) | 3586 | if (tAssetResult < m_assetthrottleMin) |
3557 | AssetthrottleOutbound = AssetthrottleMin; | 3587 | m_assetthrottleOutbound = m_assetthrottleMin; |
3558 | 3588 | ||
3559 | /* MainLog.Instance.Verbose("THROTTLE", "Using:resendbytes=" + ResendthrottleOutbound + | 3589 | /* MainLog.Instance.Verbose("THROTTLE", "Using:resendbytes=" + m_resendthrottleOutbound + |
3560 | " landbytes=" + LandthrottleOutbound + | 3590 | " landbytes=" + m_landthrottleOutbound + |
3561 | " windbytes=" + WindthrottleOutbound + | 3591 | " windbytes=" + m_windthrottleOutbound + |
3562 | " cloudbytes=" + CloudthrottleOutbound + | 3592 | " cloudbytes=" + m_cloudthrottleOutbound + |
3563 | " taskbytes=" + TaskthrottleOutbound + | 3593 | " taskbytes=" + m_taskthrottleOutbound + |
3564 | " texturebytes=" + TexturethrottleOutbound + | 3594 | " texturebytes=" + m_texturethrottleOutbound + |
3565 | " Assetbytes=" + AssetthrottleOutbound + | 3595 | " Assetbytes=" + m_assetthrottleOutbound + |
3566 | " Allbytes=" + tall); | 3596 | " Allbytes=" + tall); |
3567 | */ | 3597 | */ |
3568 | } | 3598 | } |
@@ -3570,20 +3600,20 @@ namespace OpenSim.Region.ClientStack | |||
3570 | { | 3600 | { |
3571 | // The client sent a stupid value.. | 3601 | // The client sent a stupid value.. |
3572 | // We're going to set the throttles to the minimum possible | 3602 | // We're going to set the throttles to the minimum possible |
3573 | ResendthrottleOutbound = ResendthrottleMin; | 3603 | m_resendthrottleOutbound = m_resendthrottleMin; |
3574 | LandthrottleOutbound = LandthrottleMin; | 3604 | m_landthrottleOutbound = m_landthrottleMin; |
3575 | WindthrottleOutbound = WindthrottleMin; | 3605 | m_windthrottleOutbound = m_windthrottleMin; |
3576 | CloudthrottleOutbound = CloudthrottleMin; | 3606 | m_cloudthrottleOutbound = m_cloudthrottleMin; |
3577 | TaskthrottleOutbound = TaskthrottleMin; | 3607 | m_taskthrottleOutbound = m_taskthrottleMin; |
3578 | TexturethrottleOutbound = TexturethrottleMin; | 3608 | m_texturethrottleOutbound = m_texturethrottleMin; |
3579 | AssetthrottleOutbound = AssetthrottleMin; | 3609 | m_assetthrottleOutbound = m_assetthrottleMin; |
3580 | MainLog.Instance.Verbose("THROTTLE", "ClientSentBadThrottle Using:resendbytes=" + ResendthrottleOutbound + | 3610 | MainLog.Instance.Verbose("THROTTLE", "ClientSentBadThrottle Using:resendbytes=" + m_resendthrottleOutbound + |
3581 | " landbytes=" + LandthrottleOutbound + | 3611 | " landbytes=" + m_landthrottleOutbound + |
3582 | " windbytes=" + WindthrottleOutbound + | 3612 | " windbytes=" + m_windthrottleOutbound + |
3583 | " cloudbytes=" + CloudthrottleOutbound + | 3613 | " cloudbytes=" + m_cloudthrottleOutbound + |
3584 | " taskbytes=" + TaskthrottleOutbound + | 3614 | " taskbytes=" + m_taskthrottleOutbound + |
3585 | " texturebytes=" + TexturethrottleOutbound + | 3615 | " texturebytes=" + m_texturethrottleOutbound + |
3586 | " Assetbytes=" + AssetthrottleOutbound + | 3616 | " Assetbytes=" + m_assetthrottleOutbound + |
3587 | " Allbytes=" + tall); | 3617 | " Allbytes=" + tall); |
3588 | } | 3618 | } |
3589 | } | 3619 | } |
@@ -3591,13 +3621,13 @@ namespace OpenSim.Region.ClientStack | |||
3591 | // This has the effect of 'wiggling the slider | 3621 | // This has the effect of 'wiggling the slider |
3592 | // causes prim and stuck textures that didn't download to download | 3622 | // causes prim and stuck textures that didn't download to download |
3593 | 3623 | ||
3594 | ResendBytesSent = 0; | 3624 | m_resendBytesSent = 0; |
3595 | LandBytesSent = 0; | 3625 | m_landBytesSent = 0; |
3596 | WindBytesSent = 0; | 3626 | m_windBytesSent = 0; |
3597 | CloudBytesSent = 0; | 3627 | m_cloudBytesSent = 0; |
3598 | TaskBytesSent = 0; | 3628 | m_taskBytesSent = 0; |
3599 | AssetBytesSent = 0; | 3629 | m_assetBytesSent = 0; |
3600 | TextureBytesSent = 0; | 3630 | m_textureBytesSent = 0; |
3601 | 3631 | ||
3602 | //Yay, we've finally handled the agent Throttle packet! | 3632 | //Yay, we've finally handled the agent Throttle packet! |
3603 | break; | 3633 | break; |
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 40de870..29a8219 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs | |||
@@ -396,6 +396,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
396 | module.Close(); | 396 | module.Close(); |
397 | } | 397 | } |
398 | } | 398 | } |
399 | |||
399 | Modules.Clear(); | 400 | Modules.Clear(); |
400 | 401 | ||
401 | base.Close(); | 402 | base.Close(); |