aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorMic Bowman2011-04-25 15:11:29 -0700
committerMic Bowman2011-04-25 15:11:29 -0700
commit77ab7ce084d32c45273d79e9ec4f52c43e3a1d97 (patch)
tree112d02864d1a8ff5c60693687dc7600a5fbe9f15
parentMerge branch 'master' into queuetest (diff)
downloadopensim-SC_OLD-77ab7ce084d32c45273d79e9ec4f52c43e3a1d97.zip
opensim-SC_OLD-77ab7ce084d32c45273d79e9ec4f52c43e3a1d97.tar.gz
opensim-SC_OLD-77ab7ce084d32c45273d79e9ec4f52c43e3a1d97.tar.bz2
opensim-SC_OLD-77ab7ce084d32c45273d79e9ec4f52c43e3a1d97.tar.xz
Fixed the transmission of throttles from root agent to child
agents. Child throttles are based on the number of child agents known to the root and at least 1/4 of the throttle given to the root.
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs2
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs40
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs33
3 files changed, 41 insertions, 34 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index 32a075a..cdd4224 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -11420,7 +11420,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
11420 /// <returns></returns> 11420 /// <returns></returns>
11421 public byte[] GetThrottlesPacked(float multiplier) 11421 public byte[] GetThrottlesPacked(float multiplier)
11422 { 11422 {
11423 return m_udpClient.GetThrottlesPacked(); 11423 return m_udpClient.GetThrottlesPacked(multiplier);
11424 } 11424 }
11425 11425
11426 /// <summary> 11426 /// <summary>
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs
index 494cb0c..50f1e2c 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs
@@ -329,8 +329,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
329 int asset = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); 329 int asset = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f);
330 // State is a subcategory of task that we allocate a percentage to 330 // State is a subcategory of task that we allocate a percentage to
331 int state = 0; 331 int state = 0;
332 // int state = (int)((float)task * STATE_TASK_PERCENTAGE);
333 // task -= state;
334 332
335 // Make sure none of the throttles are set below our packet MTU, 333 // Make sure none of the throttles are set below our packet MTU,
336 // otherwise a throttle could become permanently clogged 334 // otherwise a throttle could become permanently clogged
@@ -342,17 +340,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
342 texture = Math.Max(texture, LLUDPServer.MTU); 340 texture = Math.Max(texture, LLUDPServer.MTU);
343 asset = Math.Max(asset, LLUDPServer.MTU); 341 asset = Math.Max(asset, LLUDPServer.MTU);
344 342
345 int total = resend + land + wind + cloud + task + texture + asset; 343 //int total = resend + land + wind + cloud + task + texture + asset;
346
347 //m_log.DebugFormat("[LLUDPCLIENT]: {0} is setting throttles. Resend={1}, Land={2}, Wind={3}, Cloud={4}, Task={5}, Texture={6}, Asset={7}, Total={8}", 344 //m_log.DebugFormat("[LLUDPCLIENT]: {0} is setting throttles. Resend={1}, Land={2}, Wind={3}, Cloud={4}, Task={5}, Texture={6}, Asset={7}, Total={8}",
348 // AgentID, resend, land, wind, cloud, task, texture, asset, total); 345 // AgentID, resend, land, wind, cloud, task, texture, asset, total);
349 346
350 // Update the token buckets with new throttle values 347 // Update the token buckets with new throttle values
351 TokenBucket bucket; 348 TokenBucket bucket;
352 349
353 bucket = m_throttleCategory;
354 bucket.RequestedDripRate = total;
355
356 bucket = m_throttleCategories[(int)ThrottleOutPacketType.Resend]; 350 bucket = m_throttleCategories[(int)ThrottleOutPacketType.Resend];
357 bucket.RequestedDripRate = resend; 351 bucket.RequestedDripRate = resend;
358 352
@@ -381,22 +375,38 @@ namespace OpenSim.Region.ClientStack.LindenUDP
381 m_packedThrottles = null; 375 m_packedThrottles = null;
382 } 376 }
383 377
384 public byte[] GetThrottlesPacked() 378 public byte[] GetThrottlesPacked(float multiplier)
385 { 379 {
386 byte[] data = m_packedThrottles; 380 byte[] data = m_packedThrottles;
387 381
388 if (data == null) 382 if (data == null)
389 { 383 {
384 float rate;
385
390 data = new byte[7 * 4]; 386 data = new byte[7 * 4];
391 int i = 0; 387 int i = 0;
392 388
393 Buffer.BlockCopy(Utils.FloatToBytes((float)m_throttleCategories[(int)ThrottleOutPacketType.Resend].RequestedDripRate), 0, data, i, 4); i += 4; 389 // multiply by 8 to convert bytes back to bits
394 Buffer.BlockCopy(Utils.FloatToBytes((float)m_throttleCategories[(int)ThrottleOutPacketType.Land].RequestedDripRate), 0, data, i, 4); i += 4; 390 rate = (float)m_throttleCategories[(int)ThrottleOutPacketType.Resend].RequestedDripRate * 8 * multiplier;
395 Buffer.BlockCopy(Utils.FloatToBytes((float)m_throttleCategories[(int)ThrottleOutPacketType.Wind].RequestedDripRate), 0, data, i, 4); i += 4; 391 Buffer.BlockCopy(Utils.FloatToBytes(rate), 0, data, i, 4); i += 4;
396 Buffer.BlockCopy(Utils.FloatToBytes((float)m_throttleCategories[(int)ThrottleOutPacketType.Cloud].RequestedDripRate), 0, data, i, 4); i += 4; 392
397 Buffer.BlockCopy(Utils.FloatToBytes((float)m_throttleCategories[(int)ThrottleOutPacketType.Task].RequestedDripRate), 0, data, i, 4); i += 4; 393 rate = (float)m_throttleCategories[(int)ThrottleOutPacketType.Land].RequestedDripRate * 8 * multiplier;
398 Buffer.BlockCopy(Utils.FloatToBytes((float)m_throttleCategories[(int)ThrottleOutPacketType.Texture].RequestedDripRate), 0, data, i, 4); i += 4; 394 Buffer.BlockCopy(Utils.FloatToBytes(rate), 0, data, i, 4); i += 4;
399 Buffer.BlockCopy(Utils.FloatToBytes((float)m_throttleCategories[(int)ThrottleOutPacketType.Asset].RequestedDripRate), 0, data, i, 4); i += 4; 395
396 rate = (float)m_throttleCategories[(int)ThrottleOutPacketType.Wind].RequestedDripRate * 8 * multiplier;
397 Buffer.BlockCopy(Utils.FloatToBytes(rate), 0, data, i, 4); i += 4;
398
399 rate = (float)m_throttleCategories[(int)ThrottleOutPacketType.Cloud].RequestedDripRate * 8 * multiplier;
400 Buffer.BlockCopy(Utils.FloatToBytes(rate), 0, data, i, 4); i += 4;
401
402 rate = (float)m_throttleCategories[(int)ThrottleOutPacketType.Task].RequestedDripRate * 8 * multiplier;
403 Buffer.BlockCopy(Utils.FloatToBytes(rate), 0, data, i, 4); i += 4;
404
405 rate = (float)m_throttleCategories[(int)ThrottleOutPacketType.Texture].RequestedDripRate * 8 * multiplier;
406 Buffer.BlockCopy(Utils.FloatToBytes(rate), 0, data, i, 4); i += 4;
407
408 rate = (float)m_throttleCategories[(int)ThrottleOutPacketType.Asset].RequestedDripRate * 8 * multiplier;
409 Buffer.BlockCopy(Utils.FloatToBytes(rate), 0, data, i, 4); i += 4;
400 410
401 m_packedThrottles = data; 411 m_packedThrottles = data;
402 } 412 }
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 00a1487..ef0eb89 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -2632,18 +2632,17 @@ namespace OpenSim.Region.Framework.Scenes
2632 cadu.GroupAccess = 0; 2632 cadu.GroupAccess = 0;
2633 cadu.Position = AbsolutePosition; 2633 cadu.Position = AbsolutePosition;
2634 cadu.regionHandle = m_rootRegionHandle; 2634 cadu.regionHandle = m_rootRegionHandle;
2635
2636 // Throttles
2635 float multiplier = 1; 2637 float multiplier = 1;
2636 int innacurateNeighbors = m_scene.GetInaccurateNeighborCount(); 2638 int childRegions = m_knownChildRegions.Count;
2637 if (innacurateNeighbors != 0) 2639 if (childRegions != 0)
2638 { 2640 multiplier = 1f / childRegions;
2639 multiplier = 1f / (float)innacurateNeighbors; 2641
2640 } 2642 // Minimum throttle for a child region is 1/4 of the root region throttle
2641 if (multiplier <= 0f) 2643 if (multiplier <= 0.25f)
2642 {
2643 multiplier = 0.25f; 2644 multiplier = 0.25f;
2644 }
2645 2645
2646 //m_log.Info("[NeighborThrottle]: " + m_scene.GetInaccurateNeighborCount().ToString() + " - m: " + multiplier.ToString());
2647 cadu.throttles = ControllingClient.GetThrottlesPacked(multiplier); 2646 cadu.throttles = ControllingClient.GetThrottlesPacked(multiplier);
2648 cadu.Velocity = Velocity; 2647 cadu.Velocity = Velocity;
2649 2648
@@ -3039,16 +3038,14 @@ namespace OpenSim.Region.Framework.Scenes
3039 3038
3040 // Throttles 3039 // Throttles
3041 float multiplier = 1; 3040 float multiplier = 1;
3042 int innacurateNeighbors = m_scene.GetInaccurateNeighborCount(); 3041 int childRegions = m_knownChildRegions.Count;
3043 if (innacurateNeighbors != 0) 3042 if (childRegions != 0)
3044 { 3043 multiplier = 1f / childRegions;
3045 multiplier = 1f / innacurateNeighbors; 3044
3046 } 3045 // Minimum throttle for a child region is 1/4 of the root region throttle
3047 if (multiplier <= 0f) 3046 if (multiplier <= 0.25f)
3048 {
3049 multiplier = 0.25f; 3047 multiplier = 0.25f;
3050 } 3048
3051 //m_log.Info("[NeighborThrottle]: " + m_scene.GetInaccurateNeighborCount().ToString() + " - m: " + multiplier.ToString());
3052 cAgent.Throttles = ControllingClient.GetThrottlesPacked(multiplier); 3049 cAgent.Throttles = ControllingClient.GetThrottlesPacked(multiplier);
3053 3050
3054 cAgent.HeadRotation = m_headrotation; 3051 cAgent.HeadRotation = m_headrotation;