diff options
author | Sean Dague | 2007-12-06 21:59:31 +0000 |
---|---|---|
committer | Sean Dague | 2007-12-06 21:59:31 +0000 |
commit | 9326ee425b18700e4da8887ebc082f0b7e2e4760 (patch) | |
tree | d149ca6a357d4793a3484d5534d2b4d320826591 /OpenSim/Region/ClientStack/ClientView.cs | |
parent | reversing the r2599 patch, as this started causing CreateThread errors for (diff) | |
download | opensim-SC-9326ee425b18700e4da8887ebc082f0b7e2e4760.zip opensim-SC-9326ee425b18700e4da8887ebc082f0b7e2e4760.tar.gz opensim-SC-9326ee425b18700e4da8887ebc082f0b7e2e4760.tar.bz2 opensim-SC-9326ee425b18700e4da8887ebc082f0b7e2e4760.tar.xz |
added a lock to prevent multiple Timer popping races
on the packet queues.
Diffstat (limited to 'OpenSim/Region/ClientStack/ClientView.cs')
-rw-r--r-- | OpenSim/Region/ClientStack/ClientView.cs | 134 |
1 files changed, 67 insertions, 67 deletions
diff --git a/OpenSim/Region/ClientStack/ClientView.cs b/OpenSim/Region/ClientStack/ClientView.cs index 17e3567..5a3e4b7 100644 --- a/OpenSim/Region/ClientStack/ClientView.cs +++ b/OpenSim/Region/ClientStack/ClientView.cs | |||
@@ -225,76 +225,76 @@ namespace OpenSim.Region.ClientStack | |||
225 | 225 | ||
226 | // We're going to dequeue all of the saved up packets until | 226 | // 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 | 227 | // we've hit the throttle limit or there's no more packets to send |
228 | while ((bytesSent <= ((int)(throttleOutbound/throttleTimeDivisor)) && | 228 | lock (throttleTimer) { |
229 | (ResendOutgoingPacketQueue.Count > 0 || | 229 | while ((bytesSent <= ((int)(throttleOutbound/throttleTimeDivisor)) && |
230 | LandOutgoingPacketQueue.Count > 0 || | 230 | (ResendOutgoingPacketQueue.Count > 0 || |
231 | WindOutgoingPacketQueue.Count > 0 || | 231 | LandOutgoingPacketQueue.Count > 0 || |
232 | CloudOutgoingPacketQueue.Count > 0 || | 232 | WindOutgoingPacketQueue.Count > 0 || |
233 | TaskOutgoingPacketQueue.Count > 0 || | 233 | CloudOutgoingPacketQueue.Count > 0 || |
234 | AssetOutgoingPacketQueue.Count > 0 || | 234 | TaskOutgoingPacketQueue.Count > 0 || |
235 | TextureOutgoingPacketQueue.Count > 0)) && throttleLoops <= MaxThrottleLoops) | 235 | AssetOutgoingPacketQueue.Count > 0 || |
236 | { | 236 | TextureOutgoingPacketQueue.Count > 0)) && throttleLoops <= MaxThrottleLoops) |
237 | throttleLoops++; | ||
238 | //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 | |||
243 | PacketQueue.Enqueue(qpack); | ||
244 | bytesSent += qpack.Packet.ToBytes().Length; | ||
245 | ResendBytesSent += qpack.Packet.ToBytes().Length; | ||
246 | } | ||
247 | if (LandBytesSent <= ((int)(LandthrottleOutbound/throttleTimeDivisor)) && LandOutgoingPacketQueue.Count > 0) | ||
248 | { | ||
249 | QueItem qpack = LandOutgoingPacketQueue.Dequeue(); | ||
250 | |||
251 | PacketQueue.Enqueue(qpack); | ||
252 | bytesSent += qpack.Packet.ToBytes().Length; | ||
253 | LandBytesSent += qpack.Packet.ToBytes().Length; | ||
254 | } | ||
255 | if (WindBytesSent <= ((int)(WindthrottleOutbound/throttleTimeDivisor)) && WindOutgoingPacketQueue.Count > 0) | ||
256 | { | ||
257 | QueItem qpack = WindOutgoingPacketQueue.Dequeue(); | ||
258 | |||
259 | PacketQueue.Enqueue(qpack); | ||
260 | bytesSent += qpack.Packet.ToBytes().Length; | ||
261 | WindBytesSent += qpack.Packet.ToBytes().Length; | ||
262 | } | ||
263 | if (CloudBytesSent <= ((int)(CloudthrottleOutbound/throttleTimeDivisor)) && CloudOutgoingPacketQueue.Count > 0) | ||
264 | { | ||
265 | QueItem qpack = CloudOutgoingPacketQueue.Dequeue(); | ||
266 | |||
267 | PacketQueue.Enqueue(qpack); | ||
268 | bytesSent += qpack.Packet.ToBytes().Length; | ||
269 | CloudBytesSent += qpack.Packet.ToBytes().Length; | ||
270 | } | ||
271 | if (TaskBytesSent <= ((int)(TaskthrottleOutbound/throttleTimeDivisor)) && TaskOutgoingPacketQueue.Count > 0) | ||
272 | { | ||
273 | QueItem qpack = TaskOutgoingPacketQueue.Dequeue(); | ||
274 | |||
275 | PacketQueue.Enqueue(qpack); | ||
276 | bytesSent += qpack.Packet.ToBytes().Length; | ||
277 | TaskBytesSent += qpack.Packet.ToBytes().Length; | ||
278 | } | ||
279 | if (TextureBytesSent <= ((int)(TexturethrottleOutbound/throttleTimeDivisor)) && TextureOutgoingPacketQueue.Count > 0) | ||
280 | { | 237 | { |
281 | QueItem qpack = TextureOutgoingPacketQueue.Dequeue(); | 238 | throttleLoops++; |
282 | 239 | //Now comes the fun part.. we dump all our elements into PacketQueue that we've saved up. | |
283 | PacketQueue.Enqueue(qpack); | 240 | if (ResendBytesSent <= ((int)(ResendthrottleOutbound/throttleTimeDivisor)) && ResendOutgoingPacketQueue.Count > 0) |
284 | bytesSent += qpack.Packet.ToBytes().Length; | 241 | { |
285 | TextureBytesSent += qpack.Packet.ToBytes().Length; | 242 | QueItem qpack = ResendOutgoingPacketQueue.Dequeue(); |
286 | } | 243 | |
287 | if (AssetBytesSent <= ((int)(AssetthrottleOutbound/throttleTimeDivisor)) && AssetOutgoingPacketQueue.Count > 0) | 244 | PacketQueue.Enqueue(qpack); |
288 | { | 245 | bytesSent += qpack.Packet.ToBytes().Length; |
289 | QueItem qpack = AssetOutgoingPacketQueue.Dequeue(); | 246 | ResendBytesSent += qpack.Packet.ToBytes().Length; |
290 | 247 | } | |
291 | PacketQueue.Enqueue(qpack); | 248 | if (LandBytesSent <= ((int)(LandthrottleOutbound/throttleTimeDivisor)) && LandOutgoingPacketQueue.Count > 0) |
292 | bytesSent += qpack.Packet.ToBytes().Length; | 249 | { |
293 | AssetBytesSent += qpack.Packet.ToBytes().Length; | 250 | QueItem qpack = LandOutgoingPacketQueue.Dequeue(); |
251 | |||
252 | PacketQueue.Enqueue(qpack); | ||
253 | bytesSent += qpack.Packet.ToBytes().Length; | ||
254 | LandBytesSent += qpack.Packet.ToBytes().Length; | ||
255 | } | ||
256 | if (WindBytesSent <= ((int)(WindthrottleOutbound/throttleTimeDivisor)) && WindOutgoingPacketQueue.Count > 0) | ||
257 | { | ||
258 | QueItem qpack = WindOutgoingPacketQueue.Dequeue(); | ||
259 | |||
260 | PacketQueue.Enqueue(qpack); | ||
261 | bytesSent += qpack.Packet.ToBytes().Length; | ||
262 | WindBytesSent += qpack.Packet.ToBytes().Length; | ||
263 | } | ||
264 | if (CloudBytesSent <= ((int)(CloudthrottleOutbound/throttleTimeDivisor)) && CloudOutgoingPacketQueue.Count > 0) | ||
265 | { | ||
266 | QueItem qpack = CloudOutgoingPacketQueue.Dequeue(); | ||
267 | |||
268 | PacketQueue.Enqueue(qpack); | ||
269 | bytesSent += qpack.Packet.ToBytes().Length; | ||
270 | CloudBytesSent += qpack.Packet.ToBytes().Length; | ||
271 | } | ||
272 | if (TaskBytesSent <= ((int)(TaskthrottleOutbound/throttleTimeDivisor)) && TaskOutgoingPacketQueue.Count > 0) | ||
273 | { | ||
274 | QueItem qpack = TaskOutgoingPacketQueue.Dequeue(); | ||
275 | |||
276 | PacketQueue.Enqueue(qpack); | ||
277 | bytesSent += qpack.Packet.ToBytes().Length; | ||
278 | TaskBytesSent += qpack.Packet.ToBytes().Length; | ||
279 | } | ||
280 | if (TextureBytesSent <= ((int)(TexturethrottleOutbound/throttleTimeDivisor)) && TextureOutgoingPacketQueue.Count > 0) | ||
281 | { | ||
282 | QueItem qpack = TextureOutgoingPacketQueue.Dequeue(); | ||
283 | |||
284 | PacketQueue.Enqueue(qpack); | ||
285 | bytesSent += qpack.Packet.ToBytes().Length; | ||
286 | TextureBytesSent += qpack.Packet.ToBytes().Length; | ||
287 | } | ||
288 | if (AssetBytesSent <= ((int)(AssetthrottleOutbound/throttleTimeDivisor)) && AssetOutgoingPacketQueue.Count > 0) | ||
289 | { | ||
290 | QueItem qpack = AssetOutgoingPacketQueue.Dequeue(); | ||
291 | |||
292 | PacketQueue.Enqueue(qpack); | ||
293 | bytesSent += qpack.Packet.ToBytes().Length; | ||
294 | AssetBytesSent += qpack.Packet.ToBytes().Length; | ||
295 | } | ||
294 | } | 296 | } |
295 | |||
296 | } | 297 | } |
297 | |||
298 | } | 298 | } |
299 | 299 | ||
300 | public LLUUID SessionId | 300 | public LLUUID SessionId |