diff options
Diffstat (limited to 'OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs')
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs | 66 |
1 files changed, 51 insertions, 15 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs index d8ca343..8f14806 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs | |||
@@ -97,7 +97,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
97 | { | 97 | { |
98 | m_throttleDebugLevel = value; | 98 | m_throttleDebugLevel = value; |
99 | m_throttleClient.DebugLevel = m_throttleDebugLevel; | 99 | m_throttleClient.DebugLevel = m_throttleDebugLevel; |
100 | m_throttleCategory.DebugLevel = m_throttleDebugLevel; | ||
101 | foreach (TokenBucket tb in m_throttleCategories) | 100 | foreach (TokenBucket tb in m_throttleCategories) |
102 | tb.DebugLevel = m_throttleDebugLevel; | 101 | tb.DebugLevel = m_throttleDebugLevel; |
103 | } | 102 | } |
@@ -172,8 +171,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
172 | get { return m_throttleClient; } | 171 | get { return m_throttleClient; } |
173 | } | 172 | } |
174 | 173 | ||
175 | /// <summary>Throttle bucket for this agent's connection</summary> | ||
176 | private readonly TokenBucket m_throttleCategory; | ||
177 | /// <summary>Throttle buckets for each packet category</summary> | 174 | /// <summary>Throttle buckets for each packet category</summary> |
178 | private readonly TokenBucket[] m_throttleCategories; | 175 | private readonly TokenBucket[] m_throttleCategories; |
179 | /// <summary>Outgoing queues for throttled packets</summary> | 176 | /// <summary>Outgoing queues for throttled packets</summary> |
@@ -232,13 +229,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
232 | m_throttleClient | 229 | m_throttleClient |
233 | = new AdaptiveTokenBucket( | 230 | = new AdaptiveTokenBucket( |
234 | string.Format("adaptive throttle for {0} in {1}", AgentID, server.Scene.Name), | 231 | string.Format("adaptive throttle for {0} in {1}", AgentID, server.Scene.Name), |
235 | parentThrottle, rates.Total, rates.AdaptiveThrottlesEnabled); | 232 | parentThrottle, 0, rates.Total, rates.AdaptiveThrottlesEnabled); |
236 | |||
237 | // Create a token bucket throttle for the total category with the client bucket as a throttle | ||
238 | m_throttleCategory | ||
239 | = new TokenBucket( | ||
240 | string.Format("total throttle for {0} in {1}", AgentID, server.Scene.Name), | ||
241 | m_throttleClient, 0); | ||
242 | 233 | ||
243 | // Create an array of token buckets for this clients different throttle categories | 234 | // Create an array of token buckets for this clients different throttle categories |
244 | m_throttleCategories = new TokenBucket[THROTTLE_CATEGORY_COUNT]; | 235 | m_throttleCategories = new TokenBucket[THROTTLE_CATEGORY_COUNT]; |
@@ -256,7 +247,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
256 | m_throttleCategories[i] | 247 | m_throttleCategories[i] |
257 | = new TokenBucket( | 248 | = new TokenBucket( |
258 | string.Format("{0} throttle for {1} in {2}", type, AgentID, server.Scene.Name), | 249 | string.Format("{0} throttle for {1} in {2}", type, AgentID, server.Scene.Name), |
259 | m_throttleCategory, rates.GetRate(type)); | 250 | m_throttleClient, rates.GetRate(type), 0); |
260 | } | 251 | } |
261 | 252 | ||
262 | // Default the retransmission timeout to one second | 253 | // Default the retransmission timeout to one second |
@@ -301,7 +292,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
301 | m_info.taskThrottle = (int)m_throttleCategories[(int)ThrottleOutPacketType.Task].DripRate; | 292 | m_info.taskThrottle = (int)m_throttleCategories[(int)ThrottleOutPacketType.Task].DripRate; |
302 | m_info.assetThrottle = (int)m_throttleCategories[(int)ThrottleOutPacketType.Asset].DripRate; | 293 | m_info.assetThrottle = (int)m_throttleCategories[(int)ThrottleOutPacketType.Asset].DripRate; |
303 | m_info.textureThrottle = (int)m_throttleCategories[(int)ThrottleOutPacketType.Texture].DripRate; | 294 | m_info.textureThrottle = (int)m_throttleCategories[(int)ThrottleOutPacketType.Texture].DripRate; |
304 | m_info.totalThrottle = (int)m_throttleCategory.DripRate; | 295 | m_info.totalThrottle = (int)m_throttleClient.DripRate; |
296 | m_info.targetThrottle = (int)m_throttleClient.TargetDripRate; | ||
305 | m_info.maxThrottle = (int)m_throttleClient.MaxDripRate; | 297 | m_info.maxThrottle = (int)m_throttleClient.MaxDripRate; |
306 | 298 | ||
307 | return m_info; | 299 | return m_info; |
@@ -320,6 +312,33 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
320 | } | 312 | } |
321 | 313 | ||
322 | /// <summary> | 314 | /// <summary> |
315 | /// Get the total number of pakcets queued for this client. | ||
316 | /// </summary> | ||
317 | /// <returns></returns> | ||
318 | public int GetTotalPacketsQueuedCount() | ||
319 | { | ||
320 | int total = 0; | ||
321 | |||
322 | for (int i = 0; i <= (int)ThrottleOutPacketType.Asset; i++) | ||
323 | total += m_packetOutboxes[i].Count; | ||
324 | |||
325 | return total; | ||
326 | } | ||
327 | |||
328 | /// <summary> | ||
329 | /// Get the number of packets queued for the given throttle type. | ||
330 | /// </summary> | ||
331 | /// <returns></returns> | ||
332 | /// <param name="throttleType"></param> | ||
333 | public int GetPacketsQueuedCount(ThrottleOutPacketType throttleType) | ||
334 | { | ||
335 | if ((int)throttleType > 0) | ||
336 | return m_packetOutboxes[(int)throttleType].Count; | ||
337 | else | ||
338 | return 0; | ||
339 | } | ||
340 | |||
341 | /// <summary> | ||
323 | /// Return statistics information about client packet queues. | 342 | /// Return statistics information about client packet queues. |
324 | /// </summary> | 343 | /// </summary> |
325 | /// <remarks> | 344 | /// <remarks> |
@@ -388,6 +407,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
388 | int texture = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4; | 407 | int texture = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4; |
389 | int asset = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); | 408 | int asset = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); |
390 | 409 | ||
410 | if (ThrottleDebugLevel > 0) | ||
411 | { | ||
412 | long total = resend + land + wind + cloud + task + texture + asset; | ||
413 | m_log.DebugFormat( | ||
414 | "[LLUDPCLIENT]: {0} is setting throttles in {1} to Resend={2}, Land={3}, Wind={4}, Cloud={5}, Task={6}, Texture={7}, Asset={8}, TOTAL = {9}", | ||
415 | AgentID, m_udpServer.Scene.Name, resend, land, wind, cloud, task, texture, asset, total); | ||
416 | } | ||
417 | |||
391 | // Make sure none of the throttles are set below our packet MTU, | 418 | // Make sure none of the throttles are set below our packet MTU, |
392 | // otherwise a throttle could become permanently clogged | 419 | // otherwise a throttle could become permanently clogged |
393 | resend = Math.Max(resend, LLUDPServer.MTU); | 420 | resend = Math.Max(resend, LLUDPServer.MTU); |
@@ -407,11 +434,20 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
407 | //int total = resend + land + wind + cloud + task + texture + asset; | 434 | //int total = resend + land + wind + cloud + task + texture + asset; |
408 | 435 | ||
409 | if (ThrottleDebugLevel > 0) | 436 | if (ThrottleDebugLevel > 0) |
437 | { | ||
438 | long total = resend + land + wind + cloud + task + texture + asset; | ||
410 | m_log.DebugFormat( | 439 | m_log.DebugFormat( |
411 | "[LLUDPCLIENT]: {0} is setting throttles. Resend={1}, Land={2}, Wind={3}, Cloud={4}, Task={5}, Texture={6}, Asset={7}", | 440 | "[LLUDPCLIENT]: {0} is setting throttles in {1} to Resend={2}, Land={3}, Wind={4}, Cloud={5}, Task={6}, Texture={7}, Asset={8}, TOTAL = {9}", |
412 | AgentID, m_udpServer.Scene.Name, resend, land, wind, cloud, task, texture, asset); | 441 | AgentID, m_udpServer.Scene.Name, resend, land, wind, cloud, task, texture, asset, total); |
442 | } | ||
413 | 443 | ||
414 | // Update the token buckets with new throttle values | 444 | // Update the token buckets with new throttle values |
445 | if (m_throttleClient.AdaptiveEnabled) | ||
446 | { | ||
447 | long total = resend + land + wind + cloud + task + texture + asset; | ||
448 | m_throttleClient.TargetDripRate = total; | ||
449 | } | ||
450 | |||
415 | TokenBucket bucket; | 451 | TokenBucket bucket; |
416 | 452 | ||
417 | bucket = m_throttleCategories[(int)ThrottleOutPacketType.Resend]; | 453 | bucket = m_throttleCategories[(int)ThrottleOutPacketType.Resend]; |
@@ -696,7 +732,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
696 | if (!m_udpServer.OqrEngine.IsRunning) | 732 | if (!m_udpServer.OqrEngine.IsRunning) |
697 | { | 733 | { |
698 | // Asynchronously run the callback | 734 | // Asynchronously run the callback |
699 | Util.FireAndForget(FireQueueEmpty, categories); | 735 | Util.FireAndForget(FireQueueEmpty, categories, "LLUDPClient.BeginFireQueueEmpty"); |
700 | } | 736 | } |
701 | else | 737 | else |
702 | { | 738 | { |