diff options
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs | 79 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/ThrottleRates.cs | 54 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs | 41 | ||||
-rwxr-xr-x | OpenSim/Region/Framework/Scenes/Scene.cs | 6 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ScenePresence.cs | 35 |
5 files changed, 74 insertions, 141 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs index 4e9cf1c..69e53f6 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs | |||
@@ -65,11 +65,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
65 | /// </summary> | 65 | /// </summary> |
66 | public sealed class LLUDPClient | 66 | public sealed class LLUDPClient |
67 | { | 67 | { |
68 | // TODO: Make this a config setting | ||
69 | /// <summary>Percentage of the task throttle category that is allocated to avatar and prim | ||
70 | /// state updates</summary> | ||
71 | const float STATE_TASK_PERCENTAGE = 0.8f; | ||
72 | |||
73 | private static readonly ILog m_log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); | 68 | private static readonly ILog m_log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); |
74 | 69 | ||
75 | /// <summary>The number of packet categories to throttle on. If a throttle category is added | 70 | /// <summary>The number of packet categories to throttle on. If a throttle category is added |
@@ -194,6 +189,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
194 | public bool m_deliverPackets = true; | 189 | public bool m_deliverPackets = true; |
195 | 190 | ||
196 | private float m_burstTime; | 191 | private float m_burstTime; |
192 | private int m_maxRate; | ||
197 | 193 | ||
198 | public double m_lastStartpingTimeMS; | 194 | public double m_lastStartpingTimeMS; |
199 | public int m_pingMS; | 195 | public int m_pingMS; |
@@ -243,16 +239,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
243 | m_maxRTO = maxRTO; | 239 | m_maxRTO = maxRTO; |
244 | 240 | ||
245 | m_burstTime = rates.BurstTime; | 241 | m_burstTime = rates.BurstTime; |
246 | float m_burst = rates.ClientMaxRate * m_burstTime; | 242 | m_maxRate = rates.ClientMaxRate; |
247 | 243 | ||
248 | // Create a token bucket throttle for this client that has the scene token bucket as a parent | 244 | // Create a token bucket throttle for this client that has the scene token bucket as a parent |
249 | m_throttleClient = new AdaptiveTokenBucket(parentThrottle, rates.ClientMaxRate, m_burst, rates.AdaptiveThrottlesEnabled); | 245 | m_throttleClient = new AdaptiveTokenBucket(parentThrottle, m_maxRate, m_maxRate * m_burstTime, rates.AdaptiveThrottlesEnabled); |
250 | 246 | ||
251 | // Create an array of token buckets for this clients different throttle categories | 247 | // Create an array of token buckets for this clients different throttle categories |
252 | m_throttleCategories = new TokenBucket[THROTTLE_CATEGORY_COUNT]; | 248 | m_throttleCategories = new TokenBucket[THROTTLE_CATEGORY_COUNT]; |
253 | 249 | ||
254 | m_burst = rates.Total * rates.BurstTime; | ||
255 | |||
256 | for (int i = 0; i < THROTTLE_CATEGORY_COUNT; i++) | 250 | for (int i = 0; i < THROTTLE_CATEGORY_COUNT; i++) |
257 | { | 251 | { |
258 | ThrottleOutPacketType type = (ThrottleOutPacketType)i; | 252 | ThrottleOutPacketType type = (ThrottleOutPacketType)i; |
@@ -260,18 +254,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
260 | // Initialize the packet outboxes, where packets sit while they are waiting for tokens | 254 | // Initialize the packet outboxes, where packets sit while they are waiting for tokens |
261 | m_packetOutboxes[i] = new DoubleLocklessQueue<OutgoingPacket>(); | 255 | m_packetOutboxes[i] = new DoubleLocklessQueue<OutgoingPacket>(); |
262 | // Initialize the token buckets that control the throttling for each category | 256 | // Initialize the token buckets that control the throttling for each category |
263 | //m_throttleCategories[i] = new TokenBucket(m_throttleClient, rates.GetRate(type), m_burst); | ||
264 | float rate = rates.GetRate(type); | 257 | float rate = rates.GetRate(type); |
265 | float burst = rate * rates.BurstTime; | 258 | float burst = rate * m_burstTime; |
266 | m_throttleCategories[i] = new TokenBucket(m_throttleClient, rate , burst); | 259 | m_throttleCategories[i] = new TokenBucket(m_throttleClient, rate , burst); |
267 | } | 260 | } |
268 | 261 | ||
269 | // Default the retransmission timeout to one second | ||
270 | m_RTO = m_defaultRTO; | 262 | m_RTO = m_defaultRTO; |
271 | 263 | ||
272 | // Initialize this to a sane value to prevent early disconnects | 264 | // Initialize this to a sane value to prevent early disconnects |
273 | TickLastPacketReceived = Environment.TickCount & Int32.MaxValue; | 265 | TickLastPacketReceived = Environment.TickCount & Int32.MaxValue; |
274 | m_pingMS = (int)(3.0 * server.TickCountResolution); // so filter doesnt start at 0; | 266 | m_pingMS = 20; // so filter doesnt start at 0; |
275 | } | 267 | } |
276 | 268 | ||
277 | /// <summary> | 269 | /// <summary> |
@@ -429,24 +421,21 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
429 | int texture = (int)(BitConverter.ToSingle(adjData, pos) * scale); pos += 4; | 421 | int texture = (int)(BitConverter.ToSingle(adjData, pos) * scale); pos += 4; |
430 | int asset = (int)(BitConverter.ToSingle(adjData, pos) * scale); | 422 | int asset = (int)(BitConverter.ToSingle(adjData, pos) * scale); |
431 | 423 | ||
432 | |||
433 | |||
434 | // Make sure none of the throttles are set below our packet MTU, | ||
435 | // otherwise a throttle could become permanently clogged | ||
436 | |||
437 | /* now using floats | ||
438 | resend = Math.Max(resend, LLUDPServer.MTU); | ||
439 | land = Math.Max(land, LLUDPServer.MTU); | ||
440 | wind = Math.Max(wind, LLUDPServer.MTU); | ||
441 | cloud = Math.Max(cloud, LLUDPServer.MTU); | ||
442 | task = Math.Max(task, LLUDPServer.MTU); | ||
443 | texture = Math.Max(texture, LLUDPServer.MTU); | ||
444 | asset = Math.Max(asset, LLUDPServer.MTU); | ||
445 | */ | ||
446 | |||
447 | int total = resend + land + wind + cloud + task + texture + asset; | 424 | int total = resend + land + wind + cloud + task + texture + asset; |
448 | 425 | if(total > m_maxRate) | |
449 | //float m_burst = total * m_burstTime; | 426 | { |
427 | scale = (float)total / m_maxRate; | ||
428 | resend = (int)(resend * scale); | ||
429 | land = (int)(land * scale); | ||
430 | wind = (int)(wind * scale); | ||
431 | cloud = (int)(cloud * scale); | ||
432 | task = (int)(task * scale); | ||
433 | texture = (int)(texture * scale); | ||
434 | asset = (int)(texture * scale); | ||
435 | int ntotal = resend + land + wind + cloud + task + texture + asset; | ||
436 | m_log.DebugFormat("[LLUDPCLIENT]: limiting {0} bandwith from {1} to {2}",AgentID, ntotal, total); | ||
437 | total = ntotal; | ||
438 | } | ||
450 | 439 | ||
451 | if (ThrottleDebugLevel > 0) | 440 | if (ThrottleDebugLevel > 0) |
452 | { | 441 | { |
@@ -456,35 +445,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
456 | } | 445 | } |
457 | 446 | ||
458 | TokenBucket bucket; | 447 | TokenBucket bucket; |
459 | /* | ||
460 | bucket = m_throttleCategories[(int)ThrottleOutPacketType.Resend]; | ||
461 | bucket.RequestedDripRate = resend; | ||
462 | bucket.RequestedBurst = m_burst; | ||
463 | |||
464 | bucket = m_throttleCategories[(int)ThrottleOutPacketType.Land]; | ||
465 | bucket.RequestedDripRate = land; | ||
466 | bucket.RequestedBurst = m_burst; | ||
467 | |||
468 | bucket = m_throttleCategories[(int)ThrottleOutPacketType.Wind]; | ||
469 | bucket.RequestedDripRate = wind; | ||
470 | bucket.RequestedBurst = m_burst; | ||
471 | |||
472 | bucket = m_throttleCategories[(int)ThrottleOutPacketType.Cloud]; | ||
473 | bucket.RequestedDripRate = cloud; | ||
474 | bucket.RequestedBurst = m_burst; | ||
475 | |||
476 | bucket = m_throttleCategories[(int)ThrottleOutPacketType.Asset]; | ||
477 | bucket.RequestedDripRate = asset; | ||
478 | bucket.RequestedBurst = m_burst; | ||
479 | |||
480 | bucket = m_throttleCategories[(int)ThrottleOutPacketType.Task]; | ||
481 | bucket.RequestedDripRate = task; | ||
482 | bucket.RequestedBurst = m_burst; | ||
483 | |||
484 | bucket = m_throttleCategories[(int)ThrottleOutPacketType.Texture]; | ||
485 | bucket.RequestedDripRate = texture; | ||
486 | bucket.RequestedBurst = m_burst; | ||
487 | */ | ||
488 | bucket = m_throttleCategories[(int)ThrottleOutPacketType.Resend]; | 448 | bucket = m_throttleCategories[(int)ThrottleOutPacketType.Resend]; |
489 | bucket.RequestedDripRate = resend; | 449 | bucket.RequestedDripRate = resend; |
490 | bucket.RequestedBurst = resend * m_burstTime; | 450 | bucket.RequestedBurst = resend * m_burstTime; |
@@ -513,7 +473,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
513 | bucket.RequestedDripRate = texture; | 473 | bucket.RequestedDripRate = texture; |
514 | bucket.RequestedBurst = texture * m_burstTime; | 474 | bucket.RequestedBurst = texture * m_burstTime; |
515 | 475 | ||
516 | // Reset the packed throttles cached data | ||
517 | m_packedThrottles = null; | 476 | m_packedThrottles = null; |
518 | } | 477 | } |
519 | 478 | ||
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/ThrottleRates.cs b/OpenSim/Region/ClientStack/Linden/UDP/ThrottleRates.cs index 707acdd..8c60865 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/ThrottleRates.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/ThrottleRates.cs | |||
@@ -39,22 +39,22 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
39 | public sealed class ThrottleRates | 39 | public sealed class ThrottleRates |
40 | { | 40 | { |
41 | /// <summary>Drip rate for resent packets</summary> | 41 | /// <summary>Drip rate for resent packets</summary> |
42 | public int Resend; | 42 | public int Resend = 6625; |
43 | /// <summary>Drip rate for terrain packets</summary> | 43 | /// <summary>Drip rate for terrain packets</summary> |
44 | public int Land; | 44 | public int Land = 9125; |
45 | /// <summary>Drip rate for wind packets</summary> | 45 | /// <summary>Drip rate for wind packets</summary> |
46 | public int Wind; | 46 | public int Wind = 1750; |
47 | /// <summary>Drip rate for cloud packets</summary> | 47 | /// <summary>Drip rate for cloud packets</summary> |
48 | public int Cloud; | 48 | public int Cloud = 1750; |
49 | /// <summary>Drip rate for task packets</summary> | 49 | /// <summary>Drip rate for task packets</summary> |
50 | public int Task; | 50 | public int Task = 18500; |
51 | /// <summary>Drip rate for texture packets</summary> | 51 | /// <summary>Drip rate for texture packets</summary> |
52 | public int Texture; | 52 | public int Texture = 18500; |
53 | /// <summary>Drip rate for asset packets</summary> | 53 | /// <summary>Drip rate for asset packets</summary> |
54 | public int Asset; | 54 | public int Asset = 10500; |
55 | 55 | ||
56 | /// <summary>Drip rate for the parent token bucket</summary> | 56 | /// <summary>Drip rate for the parent token bucket</summary> |
57 | public int Total; | 57 | public int Total = 66750; |
58 | 58 | ||
59 | /// <summary>Flag used to enable adaptive throttles</summary> | 59 | /// <summary>Flag used to enable adaptive throttles</summary> |
60 | public bool AdaptiveThrottlesEnabled; | 60 | public bool AdaptiveThrottlesEnabled; |
@@ -66,8 +66,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
66 | /// </summary> | 66 | /// </summary> |
67 | public Int64 MinimumAdaptiveThrottleRate; | 67 | public Int64 MinimumAdaptiveThrottleRate; |
68 | 68 | ||
69 | public int ClientMaxRate; | 69 | public int ClientMaxRate = 640000; // 5,120,000 bps |
70 | public float BurstTime; | 70 | public float BurstTime = 10e-3f; |
71 | 71 | ||
72 | /// <summary> | 72 | /// <summary> |
73 | /// Default constructor | 73 | /// Default constructor |
@@ -78,29 +78,19 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
78 | try | 78 | try |
79 | { | 79 | { |
80 | IConfig throttleConfig = config.Configs["ClientStack.LindenUDP"]; | 80 | IConfig throttleConfig = config.Configs["ClientStack.LindenUDP"]; |
81 | if(throttleConfig != null) | ||
82 | { | ||
83 | ClientMaxRate = throttleConfig.GetInt("client_throttle_max_bps", ClientMaxRate); | ||
84 | if (ClientMaxRate > 1000000) | ||
85 | ClientMaxRate = 1000000; // no more than 8Mbps | ||
86 | else if (ClientMaxRate < 6250) | ||
87 | ClientMaxRate = 6250; // no less than 50kbps | ||
81 | 88 | ||
82 | // Current default total is 66750 | 89 | // Adaptive is broken |
83 | Resend = throttleConfig.GetInt("resend_default", 6625); | 90 | // AdaptiveThrottlesEnabled = throttleConfig.GetBoolean("enable_adaptive_throttles", false); |
84 | Land = throttleConfig.GetInt("land_default", 9125); | 91 | AdaptiveThrottlesEnabled = false; |
85 | Wind = throttleConfig.GetInt("wind_default", 1750); | 92 | MinimumAdaptiveThrottleRate = throttleConfig.GetInt("adaptive_throttle_min_bps", 32000); |
86 | Cloud = throttleConfig.GetInt("cloud_default", 1750); | 93 | } |
87 | Task = throttleConfig.GetInt("task_default", 18500); | ||
88 | Texture = throttleConfig.GetInt("texture_default", 18500); | ||
89 | Asset = throttleConfig.GetInt("asset_default", 10500); | ||
90 | |||
91 | Total = Resend + Land + Wind + Cloud + Task + Texture + Asset; | ||
92 | // 5120000 bps default max | ||
93 | ClientMaxRate = throttleConfig.GetInt("client_throttle_max_bps", 640000); | ||
94 | if (ClientMaxRate > 1000000) | ||
95 | ClientMaxRate = 1000000; // no more than 8Mbps | ||
96 | |||
97 | BurstTime = (float)throttleConfig.GetInt("client_throttle_burtsTimeMS", 10); | ||
98 | BurstTime *= 1e-3f; | ||
99 | |||
100 | // Adaptive is broken | ||
101 | // AdaptiveThrottlesEnabled = throttleConfig.GetBoolean("enable_adaptive_throttles", false); | ||
102 | AdaptiveThrottlesEnabled = false; | ||
103 | MinimumAdaptiveThrottleRate = throttleConfig.GetInt("adaptive_throttle_min_bps", 32000); | ||
104 | } | 94 | } |
105 | catch (Exception) { } | 95 | catch (Exception) { } |
106 | } | 96 | } |
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs b/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs index 1bf05a3..06864c0 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs | |||
@@ -45,15 +45,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
45 | 45 | ||
46 | private static Int32 m_counter = 0; | 46 | private static Int32 m_counter = 0; |
47 | 47 | ||
48 | protected const float m_timeScale = 1e-3f; | 48 | /// <summary> |
49 | |||
50 | /// <summary> | ||
51 | /// minimum recovery rate, ie bandwith | 49 | /// minimum recovery rate, ie bandwith |
52 | /// </summary> | 50 | /// </summary> |
53 | protected const float MINDRIPRATE = 500; | 51 | protected const float MINDRIPRATE = 500; |
54 | 52 | ||
55 | // minimum and maximim burst size, ie max number of bytes token can have | 53 | // maximim burst size, ie max number of bytes token can have |
56 | protected const float MINBURST = 1500; // can't be less than one MTU or it will block | ||
57 | protected const float MAXBURST = 7500; | 54 | protected const float MAXBURST = 7500; |
58 | 55 | ||
59 | /// <summary>Time of the last drip</summary> | 56 | /// <summary>Time of the last drip</summary> |
@@ -103,9 +100,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
103 | get { return m_burst; } | 100 | get { return m_burst; } |
104 | set { | 101 | set { |
105 | float rate = (value < 0 ? 0 : value); | 102 | float rate = (value < 0 ? 0 : value); |
106 | if (rate < MINBURST) | 103 | if (rate > MAXBURST) |
107 | rate = MINBURST; | ||
108 | else if (rate > MAXBURST) | ||
109 | rate = MAXBURST; | 104 | rate = MAXBURST; |
110 | 105 | ||
111 | m_burst = rate; | 106 | m_burst = rate; |
@@ -114,11 +109,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
114 | 109 | ||
115 | public float Burst | 110 | public float Burst |
116 | { | 111 | { |
117 | get { | 112 | get |
118 | float rate = RequestedBurst * BurstModifier(); | 113 | { |
119 | if (rate < MINBURST) | 114 | return RequestedBurst * BurstModifier(); ; |
120 | rate = MINBURST; | ||
121 | return (float)rate; | ||
122 | } | 115 | } |
123 | } | 116 | } |
124 | 117 | ||
@@ -156,7 +149,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
156 | if (rate < MINDRIPRATE) | 149 | if (rate < MINDRIPRATE) |
157 | rate = MINDRIPRATE; | 150 | rate = MINDRIPRATE; |
158 | 151 | ||
159 | return (float)rate; | 152 | return rate; |
160 | } | 153 | } |
161 | } | 154 | } |
162 | 155 | ||
@@ -192,7 +185,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
192 | Parent = parent; | 185 | Parent = parent; |
193 | RequestedDripRate = dripRate; | 186 | RequestedDripRate = dripRate; |
194 | RequestedBurst = MaxBurst; | 187 | RequestedBurst = MaxBurst; |
195 | m_lastDrip = Util.GetTimeStampMS() + 100000.0; // skip first drip | 188 | m_lastDrip = Util.GetTimeStamp() + 1000; // skip first drip |
196 | } | 189 | } |
197 | 190 | ||
198 | #endregion Constructor | 191 | #endregion Constructor |
@@ -214,9 +207,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
214 | /// </summary> | 207 | /// </summary> |
215 | protected float BurstModifier() | 208 | protected float BurstModifier() |
216 | { | 209 | { |
217 | // for now... burst rate is always m_quantumsPerBurst (constant) | ||
218 | // larger than drip rate so the ratio of burst requests is the | ||
219 | // same as the drip ratio | ||
220 | return DripRateModifier(); | 210 | return DripRateModifier(); |
221 | } | 211 | } |
222 | 212 | ||
@@ -272,10 +262,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
272 | Drip(); | 262 | Drip(); |
273 | 263 | ||
274 | // If we have enough tokens then remove them and return | 264 | // If we have enough tokens then remove them and return |
275 | if (m_tokenCount - amount >= 0) | 265 | if (m_tokenCount > 0) |
276 | { | 266 | { |
277 | // we don't have to remove from the parent, the drip rate is already | ||
278 | // reflective of the drip rate limits in the parent | ||
279 | m_tokenCount -= amount; | 267 | m_tokenCount -= amount; |
280 | return true; | 268 | return true; |
281 | } | 269 | } |
@@ -285,12 +273,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
285 | 273 | ||
286 | public bool CheckTokens(int amount) | 274 | public bool CheckTokens(int amount) |
287 | { | 275 | { |
288 | return (m_tokenCount - amount >= 0); | 276 | return (m_tokenCount > 0); |
289 | } | 277 | } |
290 | 278 | ||
291 | public int GetCatBytesCanSend(int timeMS) | 279 | public int GetCatBytesCanSend(int timeMS) |
292 | { | 280 | { |
293 | // return (int)(m_tokenCount + timeMS * m_dripRate * 1e-3); | ||
294 | return (int)(timeMS * DripRate * 1e-3); | 281 | return (int)(timeMS * DripRate * 1e-3); |
295 | } | 282 | } |
296 | 283 | ||
@@ -310,14 +297,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
310 | return; | 297 | return; |
311 | } | 298 | } |
312 | 299 | ||
313 | double now = Util.GetTimeStampMS(); | 300 | double now = Util.GetTimeStamp(); |
314 | double deltaMS = now - m_lastDrip; | 301 | double delta = now - m_lastDrip; |
315 | m_lastDrip = now; | 302 | m_lastDrip = now; |
316 | 303 | ||
317 | if (deltaMS <= 0) | 304 | if (delta <= 0) |
318 | return; | 305 | return; |
319 | 306 | ||
320 | m_tokenCount += (float)deltaMS * DripRate * m_timeScale; | 307 | m_tokenCount += (float)delta * DripRate; |
321 | 308 | ||
322 | float burst = Burst; | 309 | float burst = Burst; |
323 | if (m_tokenCount > burst) | 310 | if (m_tokenCount > burst) |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index ff1e922..a0a2882 100755 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -4625,12 +4625,8 @@ Label_GroupsDone: | |||
4625 | // however to avoid a race condition crossing borders.. | 4625 | // however to avoid a race condition crossing borders.. |
4626 | if (childAgentUpdate.IsChildAgent) | 4626 | if (childAgentUpdate.IsChildAgent) |
4627 | { | 4627 | { |
4628 | uint rRegionX = (uint)(cAgentData.RegionHandle >> 40); | ||
4629 | uint rRegionY = (((uint)(cAgentData.RegionHandle)) >> 8); | ||
4630 | uint tRegionX = RegionInfo.RegionLocX; | ||
4631 | uint tRegionY = RegionInfo.RegionLocY; | ||
4632 | //Send Data to ScenePresence | 4628 | //Send Data to ScenePresence |
4633 | childAgentUpdate.UpdateChildAgent(cAgentData, tRegionX, tRegionY, rRegionX, rRegionY); | 4629 | childAgentUpdate.UpdateChildAgent(cAgentData); |
4634 | // Not Implemented: | 4630 | // Not Implemented: |
4635 | //TODO: Do we need to pass the message on to one of our neighbors? | 4631 | //TODO: Do we need to pass the message on to one of our neighbors? |
4636 | } | 4632 | } |
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 4413d26..c80fba2 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -4846,7 +4846,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4846 | /// This updates important decision making data about a child agent | 4846 | /// This updates important decision making data about a child agent |
4847 | /// The main purpose is to figure out what objects to send to a child agent that's in a neighboring region | 4847 | /// The main purpose is to figure out what objects to send to a child agent that's in a neighboring region |
4848 | /// </summary> | 4848 | /// </summary> |
4849 | public void UpdateChildAgent(AgentPosition cAgentData, uint tRegionX, uint tRegionY, uint rRegionX, uint rRegionY) | 4849 | public void UpdateChildAgent(AgentPosition cAgentData) |
4850 | { | 4850 | { |
4851 | if (!IsChildAgent) | 4851 | if (!IsChildAgent) |
4852 | return; | 4852 | return; |
@@ -4854,6 +4854,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
4854 | GodController.SetState(cAgentData.GodData); | 4854 | GodController.SetState(cAgentData.GodData); |
4855 | 4855 | ||
4856 | RegionHandle = cAgentData.RegionHandle; | 4856 | RegionHandle = cAgentData.RegionHandle; |
4857 | uint rRegionX = (uint)(RegionHandle >> 40); | ||
4858 | uint rRegionY = (((uint)RegionHandle) >> 8); | ||
4859 | uint tRegionX = m_scene.RegionInfo.RegionLocX; | ||
4860 | uint tRegionY = m_scene.RegionInfo.RegionLocY; | ||
4857 | 4861 | ||
4858 | //m_log.Debug(" >>> ChildAgentPositionUpdate <<< " + rRegionX + "-" + rRegionY); | 4862 | //m_log.Debug(" >>> ChildAgentPositionUpdate <<< " + rRegionX + "-" + rRegionY); |
4859 | int shiftx = ((int)rRegionX - (int)tRegionX) * (int)Constants.RegionSize; | 4863 | int shiftx = ((int)rRegionX - (int)tRegionX) * (int)Constants.RegionSize; |
@@ -4863,11 +4867,19 @@ namespace OpenSim.Region.Framework.Scenes | |||
4863 | 4867 | ||
4864 | DrawDistance = cAgentData.Far; | 4868 | DrawDistance = cAgentData.Far; |
4865 | 4869 | ||
4866 | if (cAgentData.Position != marker) // UGH!! | 4870 | m_pos = cAgentData.Position + offset; |
4867 | m_pos = cAgentData.Position + offset; | ||
4868 | |||
4869 | CameraPosition = cAgentData.Center + offset; | 4871 | CameraPosition = cAgentData.Center + offset; |
4870 | 4872 | ||
4873 | if (cAgentData.ChildrenCapSeeds != null && cAgentData.ChildrenCapSeeds.Count > 0) | ||
4874 | { | ||
4875 | if (Scene.CapsModule != null) | ||
4876 | { | ||
4877 | Scene.CapsModule.SetChildrenSeed(UUID, cAgentData.ChildrenCapSeeds); | ||
4878 | } | ||
4879 | |||
4880 | KnownRegions = cAgentData.ChildrenCapSeeds; | ||
4881 | } | ||
4882 | |||
4871 | if ((cAgentData.Throttles != null) && cAgentData.Throttles.Length > 0) | 4883 | if ((cAgentData.Throttles != null) && cAgentData.Throttles.Length > 0) |
4872 | { | 4884 | { |
4873 | // some scaling factor | 4885 | // some scaling factor |
@@ -4880,24 +4892,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
4880 | 4892 | ||
4881 | x = x * x + y * y; | 4893 | x = x * x + y * y; |
4882 | 4894 | ||
4883 | const float distScale = 0.4f / Constants.RegionSize / Constants.RegionSize; | 4895 | float factor = 1.0f - x * 0.3f / Constants.RegionSize / Constants.RegionSize; |
4884 | float factor = 1.0f - distScale * x; | ||
4885 | if (factor < 0.2f) | 4896 | if (factor < 0.2f) |
4886 | factor = 0.2f; | 4897 | factor = 0.2f; |
4887 | 4898 | ||
4888 | ControllingClient.SetChildAgentThrottle(cAgentData.Throttles,factor); | 4899 | ControllingClient.SetChildAgentThrottle(cAgentData.Throttles,factor); |
4889 | } | 4900 | } |
4890 | 4901 | ||
4891 | if(cAgentData.ChildrenCapSeeds != null && cAgentData.ChildrenCapSeeds.Count >0) | ||
4892 | { | ||
4893 | if (Scene.CapsModule != null) | ||
4894 | { | ||
4895 | Scene.CapsModule.SetChildrenSeed(UUID, cAgentData.ChildrenCapSeeds); | ||
4896 | } | ||
4897 | |||
4898 | KnownRegions = cAgentData.ChildrenCapSeeds; | ||
4899 | } | ||
4900 | |||
4901 | //cAgentData.AVHeight; | 4902 | //cAgentData.AVHeight; |
4902 | //m_velocity = cAgentData.Velocity; | 4903 | //m_velocity = cAgentData.Velocity; |
4903 | checkRePrioritization(); | 4904 | checkRePrioritization(); |
@@ -5029,7 +5030,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
5029 | } | 5030 | } |
5030 | 5031 | ||
5031 | if ((cAgent.Throttles != null) && cAgent.Throttles.Length > 0) | 5032 | if ((cAgent.Throttles != null) && cAgent.Throttles.Length > 0) |
5032 | ControllingClient.SetChildAgentThrottle(cAgent.Throttles); | 5033 | ControllingClient.SetChildAgentThrottle(cAgent.Throttles, 1.0f); |
5033 | 5034 | ||
5034 | m_headrotation = cAgent.HeadRotation; | 5035 | m_headrotation = cAgent.HeadRotation; |
5035 | Rotation = cAgent.BodyRotation; | 5036 | Rotation = cAgent.BodyRotation; |