diff options
author | Justin Clarke Casey | 2008-10-06 16:48:41 +0000 |
---|---|---|
committer | Justin Clarke Casey | 2008-10-06 16:48:41 +0000 |
commit | 33d957207cc598e1a61edad42b4b734a26c362f9 (patch) | |
tree | 22b3a0c253746e9f45776eed0e785ebb5a5aef9b | |
parent | Mantis#2342. Thank you kindly, Ralphos for a patch that solves: (diff) | |
download | opensim-SC-33d957207cc598e1a61edad42b4b734a26c362f9.zip opensim-SC-33d957207cc598e1a61edad42b4b734a26c362f9.tar.gz opensim-SC-33d957207cc598e1a61edad42b4b734a26c362f9.tar.bz2 opensim-SC-33d957207cc598e1a61edad42b4b734a26c362f9.tar.xz |
* Change interpretation of asset throttle values to bits per second rather than bytes per second
* Changing network bandwidth in the preferences will now have a much more noticeable effect - a user may want to increase this if data is being slow to download from opensim
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/ClientStack/LindenUDP/LLPacketQueue.cs | 57 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/LindenUDP/LLPacketThrottle.cs | 22 |
2 files changed, 42 insertions, 37 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLPacketQueue.cs b/OpenSim/Region/ClientStack/LindenUDP/LLPacketQueue.cs index 1e03c88..5e4879b 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLPacketQueue.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLPacketQueue.cs | |||
@@ -109,7 +109,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
109 | TextureOutgoingPacketQueue = new Queue<LLQueItem>(); | 109 | TextureOutgoingPacketQueue = new Queue<LLQueItem>(); |
110 | AssetOutgoingPacketQueue = new Queue<LLQueItem>(); | 110 | AssetOutgoingPacketQueue = new Queue<LLQueItem>(); |
111 | 111 | ||
112 | // Set up the throttle classes (min, max, current) in bytes | 112 | // Set up the throttle classes (min, max, current) in bits per second |
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); |
115 | WindThrottle = new LLPacketThrottle(0, 100000, 0); | 115 | WindThrottle = new LLPacketThrottle(0, 100000, 0); |
@@ -118,8 +118,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
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 | ||
121 | // Total Throttle trumps all | 121 | // Total Throttle trumps all - it is the number of bits in total that are allowed to go out per second. |
122 | // Number of bytes allowed to go out per second. | ||
123 | ThrottleSettings totalThrottleSettings = userSettings.TotalThrottleSettings; | 122 | ThrottleSettings totalThrottleSettings = userSettings.TotalThrottleSettings; |
124 | if (null == totalThrottleSettings) | 123 | if (null == totalThrottleSettings) |
125 | { | 124 | { |
@@ -320,32 +319,32 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
320 | LLQueItem qpack = ResendOutgoingPacketQueue.Dequeue(); | 319 | LLQueItem qpack = ResendOutgoingPacketQueue.Dequeue(); |
321 | 320 | ||
322 | SendQueue.Enqueue(qpack); | 321 | SendQueue.Enqueue(qpack); |
323 | TotalThrottle.Add(qpack.Packet.ToBytes().Length); | 322 | TotalThrottle.AddBytes(qpack.Packet.ToBytes().Length); |
324 | ResendThrottle.Add(qpack.Packet.ToBytes().Length); | 323 | ResendThrottle.AddBytes(qpack.Packet.ToBytes().Length); |
325 | } | 324 | } |
326 | if (LandThrottle.UnderLimit() && LandOutgoingPacketQueue.Count > 0) | 325 | if (LandThrottle.UnderLimit() && LandOutgoingPacketQueue.Count > 0) |
327 | { | 326 | { |
328 | LLQueItem qpack = LandOutgoingPacketQueue.Dequeue(); | 327 | LLQueItem qpack = LandOutgoingPacketQueue.Dequeue(); |
329 | 328 | ||
330 | SendQueue.Enqueue(qpack); | 329 | SendQueue.Enqueue(qpack); |
331 | TotalThrottle.Add(qpack.Packet.ToBytes().Length); | 330 | TotalThrottle.AddBytes(qpack.Packet.ToBytes().Length); |
332 | LandThrottle.Add(qpack.Packet.ToBytes().Length); | 331 | LandThrottle.AddBytes(qpack.Packet.ToBytes().Length); |
333 | } | 332 | } |
334 | if (WindThrottle.UnderLimit() && WindOutgoingPacketQueue.Count > 0) | 333 | if (WindThrottle.UnderLimit() && WindOutgoingPacketQueue.Count > 0) |
335 | { | 334 | { |
336 | LLQueItem qpack = WindOutgoingPacketQueue.Dequeue(); | 335 | LLQueItem qpack = WindOutgoingPacketQueue.Dequeue(); |
337 | 336 | ||
338 | SendQueue.Enqueue(qpack); | 337 | SendQueue.Enqueue(qpack); |
339 | TotalThrottle.Add(qpack.Packet.ToBytes().Length); | 338 | TotalThrottle.AddBytes(qpack.Packet.ToBytes().Length); |
340 | WindThrottle.Add(qpack.Packet.ToBytes().Length); | 339 | WindThrottle.AddBytes(qpack.Packet.ToBytes().Length); |
341 | } | 340 | } |
342 | if (CloudThrottle.UnderLimit() && CloudOutgoingPacketQueue.Count > 0) | 341 | if (CloudThrottle.UnderLimit() && CloudOutgoingPacketQueue.Count > 0) |
343 | { | 342 | { |
344 | LLQueItem qpack = CloudOutgoingPacketQueue.Dequeue(); | 343 | LLQueItem qpack = CloudOutgoingPacketQueue.Dequeue(); |
345 | 344 | ||
346 | SendQueue.Enqueue(qpack); | 345 | SendQueue.Enqueue(qpack); |
347 | TotalThrottle.Add(qpack.Packet.ToBytes().Length); | 346 | TotalThrottle.AddBytes(qpack.Packet.ToBytes().Length); |
348 | CloudThrottle.Add(qpack.Packet.ToBytes().Length); | 347 | CloudThrottle.AddBytes(qpack.Packet.ToBytes().Length); |
349 | } | 348 | } |
350 | if (TaskThrottle.UnderLimit() && (TaskOutgoingPacketQueue.Count > 0 || TaskLowpriorityPacketQueue.Count > 0)) | 349 | if (TaskThrottle.UnderLimit() && (TaskOutgoingPacketQueue.Count > 0 || TaskLowpriorityPacketQueue.Count > 0)) |
351 | { | 350 | { |
@@ -360,24 +359,24 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
360 | qpack = TaskLowpriorityPacketQueue.Dequeue(); | 359 | qpack = TaskLowpriorityPacketQueue.Dequeue(); |
361 | SendQueue.Enqueue(qpack); | 360 | SendQueue.Enqueue(qpack); |
362 | } | 361 | } |
363 | TotalThrottle.Add(qpack.Packet.ToBytes().Length); | 362 | TotalThrottle.AddBytes(qpack.Packet.ToBytes().Length); |
364 | TaskThrottle.Add(qpack.Packet.ToBytes().Length); | 363 | TaskThrottle.AddBytes(qpack.Packet.ToBytes().Length); |
365 | } | 364 | } |
366 | if (TextureThrottle.UnderLimit() && TextureOutgoingPacketQueue.Count > 0) | 365 | if (TextureThrottle.UnderLimit() && TextureOutgoingPacketQueue.Count > 0) |
367 | { | 366 | { |
368 | LLQueItem qpack = TextureOutgoingPacketQueue.Dequeue(); | 367 | LLQueItem qpack = TextureOutgoingPacketQueue.Dequeue(); |
369 | 368 | ||
370 | SendQueue.Enqueue(qpack); | 369 | SendQueue.Enqueue(qpack); |
371 | TotalThrottle.Add(qpack.Packet.ToBytes().Length); | 370 | TotalThrottle.AddBytes(qpack.Packet.ToBytes().Length); |
372 | TextureThrottle.Add(qpack.Packet.ToBytes().Length); | 371 | TextureThrottle.AddBytes(qpack.Packet.ToBytes().Length); |
373 | } | 372 | } |
374 | if (AssetThrottle.UnderLimit() && AssetOutgoingPacketQueue.Count > 0) | 373 | if (AssetThrottle.UnderLimit() && AssetOutgoingPacketQueue.Count > 0) |
375 | { | 374 | { |
376 | LLQueItem qpack = AssetOutgoingPacketQueue.Dequeue(); | 375 | LLQueItem qpack = AssetOutgoingPacketQueue.Dequeue(); |
377 | 376 | ||
378 | SendQueue.Enqueue(qpack); | 377 | SendQueue.Enqueue(qpack); |
379 | TotalThrottle.Add(qpack.Packet.ToBytes().Length); | 378 | TotalThrottle.AddBytes(qpack.Packet.ToBytes().Length); |
380 | AssetThrottle.Add(qpack.Packet.ToBytes().Length); | 379 | AssetThrottle.AddBytes(qpack.Packet.ToBytes().Length); |
381 | } | 380 | } |
382 | } | 381 | } |
383 | // m_log.Info("[THROTTLE]: Processed " + throttleLoops + " packets"); | 382 | // m_log.Info("[THROTTLE]: Processed " + throttleLoops + " packets"); |
@@ -404,8 +403,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
404 | try | 403 | try |
405 | { | 404 | { |
406 | Monitor.Enter(this); | 405 | Monitor.Enter(this); |
407 | throttle.Add(item.Packet.ToBytes().Length); | 406 | throttle.AddBytes(item.Packet.ToBytes().Length); |
408 | TotalThrottle.Add(item.Packet.ToBytes().Length); | 407 | TotalThrottle.AddBytes(item.Packet.ToBytes().Length); |
409 | SendQueue.Enqueue(item); | 408 | SendQueue.Enqueue(item); |
410 | } | 409 | } |
411 | catch (Exception e) | 410 | catch (Exception e) |
@@ -508,16 +507,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
508 | tAsset = (int) BitConverter.ToSingle(throttle, j); | 507 | tAsset = (int) BitConverter.ToSingle(throttle, j); |
509 | 508 | ||
510 | tall = tResend + tLand + tWind + tCloud + tTask + tTexture + tAsset; | 509 | tall = tResend + tLand + tWind + tCloud + tTask + tTexture + tAsset; |
511 | /* | 510 | |
512 | m_log.Info("[CLIENT]: Client AgentThrottle - Got throttle:resendbytes=" + tResend + | 511 | m_log.Info("[CLIENT]: Client AgentThrottle - Got throttle:resendbits=" + tResend + |
513 | " landbytes=" + tLand + | 512 | " landbits=" + tLand + |
514 | " windbytes=" + tWind + | 513 | " windbits=" + tWind + |
515 | " cloudbytes=" + tCloud + | 514 | " cloudbits=" + tCloud + |
516 | " taskbytes=" + tTask + | 515 | " taskbits=" + tTask + |
517 | " texturebytes=" + tTexture + | 516 | " texturebits=" + tTexture + |
518 | " Assetbytes=" + tAsset + | 517 | " Assetbits=" + tAsset + |
519 | " Allbytes=" + tall); | 518 | " Allbits=" + tall); |
520 | */ | 519 | |
521 | 520 | ||
522 | // Total Sanity | 521 | // Total Sanity |
523 | // Make sure that the client sent sane total values. | 522 | // Make sure that the client sent sane total values. |
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLPacketThrottle.cs b/OpenSim/Region/ClientStack/LindenUDP/LLPacketThrottle.cs index b9f4594..bfb3f6e 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLPacketThrottle.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLPacketThrottle.cs | |||
@@ -26,37 +26,43 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | namespace OpenSim.Region.ClientStack.LindenUDP | 28 | namespace OpenSim.Region.ClientStack.LindenUDP |
29 | { | 29 | { |
30 | public class LLPacketThrottle | 30 | public class LLPacketThrottle |
31 | { | 31 | { |
32 | private readonly int m_maxAllowableThrottle; | 32 | private readonly int m_maxAllowableThrottle; |
33 | private readonly int m_minAllowableThrottle; | 33 | private readonly int m_minAllowableThrottle; |
34 | private int m_currentThrottle; | 34 | private int m_currentThrottle; |
35 | private const int m_throttleTimeDivisor = 7; | 35 | private const int m_throttleTimeDivisor = 7; |
36 | private int m_currentBytesSent; | 36 | private int m_currentBitsSent; |
37 | 37 | ||
38 | public LLPacketThrottle(int Min, int Max, int Throttle) | 38 | public LLPacketThrottle(int Min, int Max, int Throttle) |
39 | { | 39 | { |
40 | m_maxAllowableThrottle = Max; | 40 | m_maxAllowableThrottle = Max; |
41 | m_minAllowableThrottle = Min; | 41 | m_minAllowableThrottle = Min; |
42 | m_currentThrottle = Throttle; | 42 | m_currentThrottle = Throttle; |
43 | m_currentBytesSent = 0; | 43 | m_currentBitsSent = 0; |
44 | } | 44 | } |
45 | 45 | ||
46 | public void Reset() | 46 | public void Reset() |
47 | { | 47 | { |
48 | m_currentBytesSent = 0; | 48 | m_currentBitsSent = 0; |
49 | } | 49 | } |
50 | 50 | ||
51 | public bool UnderLimit() | 51 | public bool UnderLimit() |
52 | { | 52 | { |
53 | return (m_currentBytesSent < (m_currentThrottle/m_throttleTimeDivisor)); | 53 | return (m_currentBitsSent < (m_currentThrottle/m_throttleTimeDivisor)); |
54 | } | ||
55 | |||
56 | public int AddBits(int bits) | ||
57 | { | ||
58 | m_currentBitsSent += bits; | ||
59 | return m_currentBitsSent; | ||
54 | } | 60 | } |
55 | 61 | ||
56 | public int Add(int bytes) | 62 | public int AddBytes(int bytes) |
57 | { | 63 | { |
58 | m_currentBytesSent += bytes; | 64 | m_currentBitsSent += bytes * 8; |
59 | return m_currentBytesSent; | 65 | return m_currentBitsSent; |
60 | } | 66 | } |
61 | 67 | ||
62 | // Properties | 68 | // Properties |