aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Region/ClientStack/ClientView.PacketQueue.cs98
1 files changed, 27 insertions, 71 deletions
diff --git a/OpenSim/Region/ClientStack/ClientView.PacketQueue.cs b/OpenSim/Region/ClientStack/ClientView.PacketQueue.cs
index 02639bf..d7b86e8 100644
--- a/OpenSim/Region/ClientStack/ClientView.PacketQueue.cs
+++ b/OpenSim/Region/ClientStack/ClientView.PacketQueue.cs
@@ -220,6 +220,26 @@ namespace OpenSim.Region.ClientStack
220 } 220 }
221 } 221 }
222 222
223 private void ThrottleCheck(ref int TypeBytesSent, int Throttle, Queue<QueItem> q, QueItem item)
224 {
225 // The idea.. is if the packet throttle queues are empty
226 // and the client is under throttle for the type. Queue
227 // it up directly. This basically short cuts having to
228 // wait for the timer to fire to put things into the
229 // output queue
230
231 if(q.Count == 0 && TypeBytesSent <= ((int)(Throttle / throttleTimeDivisor)))
232 {
233 bytesSent += item.Packet.ToBytes().Length;
234 TypeBytesSent += item.Packet.ToBytes().Length;
235 PacketQueue.Enqueue(item);
236 }
237 else
238 {
239 q.Enqueue(item);
240 }
241 }
242
223 public virtual void OutPacket(Packet NewPack, ThrottleOutPacketType throttlePacketType) 243 public virtual void OutPacket(Packet NewPack, ThrottleOutPacketType throttlePacketType)
224 { 244 {
225 QueItem item = new QueItem(); 245 QueItem item = new QueItem();
@@ -232,92 +252,28 @@ namespace OpenSim.Region.ClientStack
232 switch (throttlePacketType) 252 switch (throttlePacketType)
233 { 253 {
234 case ThrottleOutPacketType.Resend: 254 case ThrottleOutPacketType.Resend:
235 if (ResendBytesSent <= ((int)(ResendthrottleOutbound / throttleTimeDivisor)) && ResendOutgoingPacketQueue.Count == 0) 255 ThrottleCheck(ref ResendBytesSent, ResendthrottleOutbound, ResendOutgoingPacketQueue, item);
236 {
237 bytesSent += item.Packet.ToBytes().Length;
238 ResendBytesSent += item.Packet.ToBytes().Length;
239 PacketQueue.Enqueue(item);
240 }
241 else
242 {
243 ResendOutgoingPacketQueue.Enqueue(item);
244 }
245 break; 256 break;
246 case ThrottleOutPacketType.Texture: 257 case ThrottleOutPacketType.Texture:
247 if (TextureBytesSent <= ((int)(TexturethrottleOutbound / throttleTimeDivisor)) && TextureOutgoingPacketQueue.Count == 0) 258 ThrottleCheck(ref TextureBytesSent, TexturethrottleOutbound, TextureOutgoingPacketQueue, item);
248 {
249 bytesSent += item.Packet.ToBytes().Length;
250 TextureBytesSent += item.Packet.ToBytes().Length;
251 PacketQueue.Enqueue(item);
252 }
253 else
254 {
255 TextureOutgoingPacketQueue.Enqueue(item);
256 }
257 break; 259 break;
258 case ThrottleOutPacketType.Task: 260 case ThrottleOutPacketType.Task:
259 if (TaskBytesSent <= ((int)(TexturethrottleOutbound / throttleTimeDivisor)) && TaskOutgoingPacketQueue.Count == 0) 261 ThrottleCheck(ref TaskBytesSent, TaskthrottleOutbound, TaskOutgoingPacketQueue, item);
260 {
261 bytesSent += item.Packet.ToBytes().Length;
262 TaskBytesSent += item.Packet.ToBytes().Length;
263 PacketQueue.Enqueue(item);
264 }
265 else
266 {
267 TaskOutgoingPacketQueue.Enqueue(item);
268 }
269 break; 262 break;
270 case ThrottleOutPacketType.Land: 263 case ThrottleOutPacketType.Land:
271 if (LandBytesSent <= ((int)(LandthrottleOutbound / throttleTimeDivisor)) && LandOutgoingPacketQueue.Count == 0) 264 ThrottleCheck(ref LandBytesSent, LandthrottleOutbound, LandOutgoingPacketQueue, item);
272 {
273 bytesSent += item.Packet.ToBytes().Length;
274 LandBytesSent += item.Packet.ToBytes().Length;
275 PacketQueue.Enqueue(item);
276 }
277 else
278 {
279 LandOutgoingPacketQueue.Enqueue(item);
280 }
281 break; 265 break;
282 case ThrottleOutPacketType.Asset: 266 case ThrottleOutPacketType.Asset:
283 if (AssetBytesSent <= ((int)(AssetthrottleOutbound / throttleTimeDivisor)) && AssetOutgoingPacketQueue.Count == 0) 267 ThrottleCheck(ref AssetBytesSent, AssetthrottleOutbound, AssetOutgoingPacketQueue, item);
284 {
285 bytesSent += item.Packet.ToBytes().Length;
286 AssetBytesSent += item.Packet.ToBytes().Length;
287 PacketQueue.Enqueue(item);
288 }
289 else
290 {
291 AssetOutgoingPacketQueue.Enqueue(item);
292 }
293 break; 268 break;
294 case ThrottleOutPacketType.Cloud: 269 case ThrottleOutPacketType.Cloud:
295 if (CloudBytesSent <= ((int)(CloudthrottleOutbound / throttleTimeDivisor)) && CloudOutgoingPacketQueue.Count == 0) 270 ThrottleCheck(ref CloudBytesSent, CloudthrottleOutbound, CloudOutgoingPacketQueue, item);
296 {
297 bytesSent += item.Packet.ToBytes().Length;
298 CloudBytesSent += item.Packet.ToBytes().Length;
299 PacketQueue.Enqueue(item);
300 }
301 else
302 {
303 CloudOutgoingPacketQueue.Enqueue(item);
304 }
305 break; 271 break;
306 case ThrottleOutPacketType.Wind: 272 case ThrottleOutPacketType.Wind:
307 if (WindBytesSent <= ((int)(WindthrottleOutbound / throttleTimeDivisor)) && WindOutgoingPacketQueue.Count == 0) 273 ThrottleCheck(ref WindBytesSent, WindthrottleOutbound, WindOutgoingPacketQueue, item);
308 {
309 bytesSent += item.Packet.ToBytes().Length;
310 WindBytesSent += item.Packet.ToBytes().Length;
311 PacketQueue.Enqueue(item);
312 }
313 else
314 {
315 WindOutgoingPacketQueue.Enqueue(item);
316 }
317 break; 274 break;
318 275
319 default: 276 default:
320
321 // Acknowledgements and other such stuff should go directly to the blocking Queue 277 // Acknowledgements and other such stuff should go directly to the blocking Queue
322 // Throttling them may and likely 'will' be problematic 278 // Throttling them may and likely 'will' be problematic
323 PacketQueue.Enqueue(item); 279 PacketQueue.Enqueue(item);