diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs | 243 |
1 files changed, 189 insertions, 54 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs index 8963756..0394e54 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs | |||
@@ -31,6 +31,7 @@ using System.Net; | |||
31 | using System.Threading; | 31 | using System.Threading; |
32 | using log4net; | 32 | using log4net; |
33 | using OpenSim.Framework; | 33 | using OpenSim.Framework; |
34 | using OpenSim.Framework.Monitoring; | ||
34 | using OpenMetaverse; | 35 | using OpenMetaverse; |
35 | using OpenMetaverse.Packets; | 36 | using OpenMetaverse.Packets; |
36 | 37 | ||
@@ -75,12 +76,41 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
75 | /// or removed, this number must also change</summary> | 76 | /// or removed, this number must also change</summary> |
76 | const int THROTTLE_CATEGORY_COUNT = 8; | 77 | const int THROTTLE_CATEGORY_COUNT = 8; |
77 | 78 | ||
79 | /// <summary> | ||
80 | /// Controls whether information is logged about each outbound packet immediately before it is sent. For debug purposes. | ||
81 | /// </summary> | ||
82 | /// <remarks>Any level above 0 will turn on logging.</remarks> | ||
83 | public int DebugDataOutLevel { get; set; } | ||
84 | |||
85 | /// <summary> | ||
86 | /// Controls whether information is logged about each outbound packet immediately before it is sent. For debug purposes. | ||
87 | /// </summary> | ||
88 | /// <remarks>Any level above 0 will turn on logging.</remarks> | ||
89 | public int ThrottleDebugLevel | ||
90 | { | ||
91 | get | ||
92 | { | ||
93 | return m_throttleDebugLevel; | ||
94 | } | ||
95 | |||
96 | set | ||
97 | { | ||
98 | m_throttleDebugLevel = value; | ||
99 | m_throttleClient.DebugLevel = m_throttleDebugLevel; | ||
100 | foreach (TokenBucket tb in m_throttleCategories) | ||
101 | tb.DebugLevel = m_throttleDebugLevel; | ||
102 | } | ||
103 | } | ||
104 | private int m_throttleDebugLevel; | ||
105 | |||
78 | /// <summary>Fired when updated networking stats are produced for this client</summary> | 106 | /// <summary>Fired when updated networking stats are produced for this client</summary> |
79 | public event PacketStats OnPacketStats; | 107 | public event PacketStats OnPacketStats; |
80 | /// <summary>Fired when the queue for a packet category is empty. This event can be | 108 | /// <summary>Fired when the queue for a packet category is empty. This event can be |
81 | /// hooked to put more data on the empty queue</summary> | 109 | /// hooked to put more data on the empty queue</summary> |
82 | public event QueueEmpty OnQueueEmpty; | 110 | public event QueueEmpty OnQueueEmpty; |
83 | 111 | ||
112 | public event Func<ThrottleOutPacketTypeFlags, bool> HasUpdates; | ||
113 | |||
84 | /// <summary>AgentID for this client</summary> | 114 | /// <summary>AgentID for this client</summary> |
85 | public readonly UUID AgentID; | 115 | public readonly UUID AgentID; |
86 | /// <summary>The remote address of the connected client</summary> | 116 | /// <summary>The remote address of the connected client</summary> |
@@ -89,8 +119,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
89 | public readonly uint CircuitCode; | 119 | public readonly uint CircuitCode; |
90 | /// <summary>Sequence numbers of packets we've received (for duplicate checking)</summary> | 120 | /// <summary>Sequence numbers of packets we've received (for duplicate checking)</summary> |
91 | public readonly IncomingPacketHistoryCollection PacketArchive = new IncomingPacketHistoryCollection(200); | 121 | public readonly IncomingPacketHistoryCollection PacketArchive = new IncomingPacketHistoryCollection(200); |
122 | |||
123 | /// <summary> | ||
124 | /// If true then we take action in response to unacked reliably sent packets such as resending the packet. | ||
125 | /// </summary> | ||
126 | public bool ProcessUnackedSends { get; set; } | ||
127 | |||
92 | /// <summary>Packets we have sent that need to be ACKed by the client</summary> | 128 | /// <summary>Packets we have sent that need to be ACKed by the client</summary> |
93 | public readonly UnackedPacketCollection NeedAcks = new UnackedPacketCollection(); | 129 | public readonly UnackedPacketCollection NeedAcks = new UnackedPacketCollection(); |
130 | |||
94 | /// <summary>ACKs that are queued up, waiting to be sent to the client</summary> | 131 | /// <summary>ACKs that are queued up, waiting to be sent to the client</summary> |
95 | public readonly OpenSim.Framework.LocklessQueue<uint> PendingAcks = new OpenSim.Framework.LocklessQueue<uint>(); | 132 | public readonly OpenSim.Framework.LocklessQueue<uint> PendingAcks = new OpenSim.Framework.LocklessQueue<uint>(); |
96 | 133 | ||
@@ -141,8 +178,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
141 | get { return m_throttleClient; } | 178 | get { return m_throttleClient; } |
142 | } | 179 | } |
143 | 180 | ||
144 | /// <summary>Throttle bucket for this agent's connection</summary> | ||
145 | private readonly TokenBucket m_throttleCategory; | ||
146 | /// <summary>Throttle buckets for each packet category</summary> | 181 | /// <summary>Throttle buckets for each packet category</summary> |
147 | private readonly TokenBucket[] m_throttleCategories; | 182 | private readonly TokenBucket[] m_throttleCategories; |
148 | /// <summary>Outgoing queues for throttled packets</summary> | 183 | /// <summary>Outgoing queues for throttled packets</summary> |
@@ -160,6 +195,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
160 | private int m_maxRTO = 60000; | 195 | private int m_maxRTO = 60000; |
161 | 196 | ||
162 | /// <summary> | 197 | /// <summary> |
198 | /// This is the percentage of the udp texture queue to add to the task queue since | ||
199 | /// textures are now generally handled through http. | ||
200 | /// </summary> | ||
201 | private double m_cannibalrate = 0.0; | ||
202 | |||
203 | private ClientInfo m_info = new ClientInfo(); | ||
204 | |||
205 | /// <summary> | ||
163 | /// Default constructor | 206 | /// Default constructor |
164 | /// </summary> | 207 | /// </summary> |
165 | /// <param name="server">Reference to the UDP server this client is connected to</param> | 208 | /// <param name="server">Reference to the UDP server this client is connected to</param> |
@@ -189,21 +232,31 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
189 | if (maxRTO != 0) | 232 | if (maxRTO != 0) |
190 | m_maxRTO = maxRTO; | 233 | m_maxRTO = maxRTO; |
191 | 234 | ||
235 | ProcessUnackedSends = true; | ||
236 | |||
192 | // Create a token bucket throttle for this client that has the scene token bucket as a parent | 237 | // Create a token bucket throttle for this client that has the scene token bucket as a parent |
193 | m_throttleClient = new AdaptiveTokenBucket(parentThrottle, rates.Total, rates.AdaptiveThrottlesEnabled); | 238 | m_throttleClient |
194 | // Create a token bucket throttle for the total categary with the client bucket as a throttle | 239 | = new AdaptiveTokenBucket( |
195 | m_throttleCategory = new TokenBucket(m_throttleClient, 0); | 240 | string.Format("adaptive throttle for {0} in {1}", AgentID, server.Scene.Name), |
241 | parentThrottle, 0, rates.Total, rates.MinimumAdaptiveThrottleRate, rates.AdaptiveThrottlesEnabled); | ||
242 | |||
196 | // Create an array of token buckets for this clients different throttle categories | 243 | // Create an array of token buckets for this clients different throttle categories |
197 | m_throttleCategories = new TokenBucket[THROTTLE_CATEGORY_COUNT]; | 244 | m_throttleCategories = new TokenBucket[THROTTLE_CATEGORY_COUNT]; |
198 | 245 | ||
246 | m_cannibalrate = rates.CannibalizeTextureRate; | ||
247 | |||
199 | for (int i = 0; i < THROTTLE_CATEGORY_COUNT; i++) | 248 | for (int i = 0; i < THROTTLE_CATEGORY_COUNT; i++) |
200 | { | 249 | { |
201 | ThrottleOutPacketType type = (ThrottleOutPacketType)i; | 250 | ThrottleOutPacketType type = (ThrottleOutPacketType)i; |
202 | 251 | ||
203 | // Initialize the packet outboxes, where packets sit while they are waiting for tokens | 252 | // Initialize the packet outboxes, where packets sit while they are waiting for tokens |
204 | m_packetOutboxes[i] = new OpenSim.Framework.LocklessQueue<OutgoingPacket>(); | 253 | m_packetOutboxes[i] = new OpenSim.Framework.LocklessQueue<OutgoingPacket>(); |
254 | |||
205 | // Initialize the token buckets that control the throttling for each category | 255 | // Initialize the token buckets that control the throttling for each category |
206 | m_throttleCategories[i] = new TokenBucket(m_throttleCategory, rates.GetRate(type)); | 256 | m_throttleCategories[i] |
257 | = new TokenBucket( | ||
258 | string.Format("{0} throttle for {1} in {2}", type, AgentID, server.Scene.Name), | ||
259 | m_throttleClient, rates.GetRate(type), 0); | ||
207 | } | 260 | } |
208 | 261 | ||
209 | // Default the retransmission timeout to one second | 262 | // Default the retransmission timeout to one second |
@@ -240,20 +293,19 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
240 | // TODO: This data structure is wrong in so many ways. Locking and copying the entire lists | 293 | // TODO: This data structure is wrong in so many ways. Locking and copying the entire lists |
241 | // of pending and needed ACKs for every client every time some method wants information about | 294 | // of pending and needed ACKs for every client every time some method wants information about |
242 | // this connection is a recipe for poor performance | 295 | // this connection is a recipe for poor performance |
243 | ClientInfo info = new ClientInfo(); | 296 | |
244 | info.pendingAcks = new Dictionary<uint, uint>(); | 297 | m_info.resendThrottle = (int)m_throttleCategories[(int)ThrottleOutPacketType.Resend].DripRate; |
245 | info.needAck = new Dictionary<uint, byte[]>(); | 298 | m_info.landThrottle = (int)m_throttleCategories[(int)ThrottleOutPacketType.Land].DripRate; |
246 | 299 | m_info.windThrottle = (int)m_throttleCategories[(int)ThrottleOutPacketType.Wind].DripRate; | |
247 | info.resendThrottle = (int)m_throttleCategories[(int)ThrottleOutPacketType.Resend].DripRate; | 300 | m_info.cloudThrottle = (int)m_throttleCategories[(int)ThrottleOutPacketType.Cloud].DripRate; |
248 | info.landThrottle = (int)m_throttleCategories[(int)ThrottleOutPacketType.Land].DripRate; | 301 | m_info.taskThrottle = (int)m_throttleCategories[(int)ThrottleOutPacketType.Task].DripRate; |
249 | info.windThrottle = (int)m_throttleCategories[(int)ThrottleOutPacketType.Wind].DripRate; | 302 | m_info.assetThrottle = (int)m_throttleCategories[(int)ThrottleOutPacketType.Asset].DripRate; |
250 | info.cloudThrottle = (int)m_throttleCategories[(int)ThrottleOutPacketType.Cloud].DripRate; | 303 | m_info.textureThrottle = (int)m_throttleCategories[(int)ThrottleOutPacketType.Texture].DripRate; |
251 | info.taskThrottle = (int)m_throttleCategories[(int)ThrottleOutPacketType.Task].DripRate; | 304 | m_info.totalThrottle = (int)m_throttleClient.DripRate; |
252 | info.assetThrottle = (int)m_throttleCategories[(int)ThrottleOutPacketType.Asset].DripRate; | 305 | m_info.targetThrottle = (int)m_throttleClient.TargetDripRate; |
253 | info.textureThrottle = (int)m_throttleCategories[(int)ThrottleOutPacketType.Texture].DripRate; | 306 | m_info.maxThrottle = (int)m_throttleClient.MaxDripRate; |
254 | info.totalThrottle = (int)m_throttleCategory.DripRate; | 307 | |
255 | 308 | return m_info; | |
256 | return info; | ||
257 | } | 309 | } |
258 | 310 | ||
259 | /// <summary> | 311 | /// <summary> |
@@ -269,6 +321,33 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
269 | } | 321 | } |
270 | 322 | ||
271 | /// <summary> | 323 | /// <summary> |
324 | /// Get the total number of pakcets queued for this client. | ||
325 | /// </summary> | ||
326 | /// <returns></returns> | ||
327 | public int GetTotalPacketsQueuedCount() | ||
328 | { | ||
329 | int total = 0; | ||
330 | |||
331 | for (int i = 0; i <= (int)ThrottleOutPacketType.Asset; i++) | ||
332 | total += m_packetOutboxes[i].Count; | ||
333 | |||
334 | return total; | ||
335 | } | ||
336 | |||
337 | /// <summary> | ||
338 | /// Get the number of packets queued for the given throttle type. | ||
339 | /// </summary> | ||
340 | /// <returns></returns> | ||
341 | /// <param name="throttleType"></param> | ||
342 | public int GetPacketsQueuedCount(ThrottleOutPacketType throttleType) | ||
343 | { | ||
344 | if ((int)throttleType > 0) | ||
345 | return m_packetOutboxes[(int)throttleType].Count; | ||
346 | else | ||
347 | return 0; | ||
348 | } | ||
349 | |||
350 | /// <summary> | ||
272 | /// Return statistics information about client packet queues. | 351 | /// Return statistics information about client packet queues. |
273 | /// </summary> | 352 | /// </summary> |
274 | /// <remarks> | 353 | /// <remarks> |
@@ -278,7 +357,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
278 | public string GetStats() | 357 | public string GetStats() |
279 | { | 358 | { |
280 | return string.Format( | 359 | return string.Format( |
281 | "{0,7} {1,7} {2,7} {3,9} {4,7} {5,7} {6,7} {7,7} {8,7} {9,8} {10,7} {11,7} {12,7}", | 360 | "{0,7} {1,7} {2,7} {3,9} {4,7} {5,7} {6,7} {7,7} {8,7} {9,8} {10,7} {11,7}", |
282 | Util.EnvironmentTickCountSubtract(TickLastPacketReceived), | 361 | Util.EnvironmentTickCountSubtract(TickLastPacketReceived), |
283 | PacketsReceived, | 362 | PacketsReceived, |
284 | PacketsSent, | 363 | PacketsSent, |
@@ -290,8 +369,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
290 | m_packetOutboxes[(int)ThrottleOutPacketType.Cloud].Count, | 369 | m_packetOutboxes[(int)ThrottleOutPacketType.Cloud].Count, |
291 | m_packetOutboxes[(int)ThrottleOutPacketType.Task].Count, | 370 | m_packetOutboxes[(int)ThrottleOutPacketType.Task].Count, |
292 | m_packetOutboxes[(int)ThrottleOutPacketType.Texture].Count, | 371 | m_packetOutboxes[(int)ThrottleOutPacketType.Texture].Count, |
293 | m_packetOutboxes[(int)ThrottleOutPacketType.Asset].Count, | 372 | m_packetOutboxes[(int)ThrottleOutPacketType.Asset].Count); |
294 | m_packetOutboxes[(int)ThrottleOutPacketType.State].Count); | ||
295 | } | 373 | } |
296 | 374 | ||
297 | public void SendPacketStats() | 375 | public void SendPacketStats() |
@@ -337,8 +415,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
337 | int task = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4; | 415 | int task = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4; |
338 | int texture = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4; | 416 | int texture = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4; |
339 | int asset = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); | 417 | int asset = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); |
340 | // State is a subcategory of task that we allocate a percentage to | 418 | |
341 | int state = 0; | 419 | if (ThrottleDebugLevel > 0) |
420 | { | ||
421 | long total = resend + land + wind + cloud + task + texture + asset; | ||
422 | m_log.DebugFormat( | ||
423 | "[LLUDPCLIENT]: {0} is setting throttles in {1} to Resend={2}, Land={3}, Wind={4}, Cloud={5}, Task={6}, Texture={7}, Asset={8}, TOTAL = {9}", | ||
424 | AgentID, m_udpServer.Scene.Name, resend, land, wind, cloud, task, texture, asset, total); | ||
425 | } | ||
342 | 426 | ||
343 | // Make sure none of the throttles are set below our packet MTU, | 427 | // Make sure none of the throttles are set below our packet MTU, |
344 | // otherwise a throttle could become permanently clogged | 428 | // otherwise a throttle could become permanently clogged |
@@ -350,11 +434,29 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
350 | texture = Math.Max(texture, LLUDPServer.MTU); | 434 | texture = Math.Max(texture, LLUDPServer.MTU); |
351 | asset = Math.Max(asset, LLUDPServer.MTU); | 435 | asset = Math.Max(asset, LLUDPServer.MTU); |
352 | 436 | ||
437 | // Since most textures are now delivered through http, make it possible | ||
438 | // to cannibalize some of the bw from the texture throttle to use for | ||
439 | // the task queue (e.g. object updates) | ||
440 | task = task + (int)(m_cannibalrate * texture); | ||
441 | texture = (int)((1 - m_cannibalrate) * texture); | ||
442 | |||
353 | //int total = resend + land + wind + cloud + task + texture + asset; | 443 | //int total = resend + land + wind + cloud + task + texture + asset; |
354 | //m_log.DebugFormat("[LLUDPCLIENT]: {0} is setting throttles. Resend={1}, Land={2}, Wind={3}, Cloud={4}, Task={5}, Texture={6}, Asset={7}, Total={8}", | 444 | |
355 | // AgentID, resend, land, wind, cloud, task, texture, asset, total); | 445 | if (ThrottleDebugLevel > 0) |
446 | { | ||
447 | long total = resend + land + wind + cloud + task + texture + asset; | ||
448 | m_log.DebugFormat( | ||
449 | "[LLUDPCLIENT]: {0} is setting throttles in {1} to Resend={2}, Land={3}, Wind={4}, Cloud={5}, Task={6}, Texture={7}, Asset={8}, TOTAL = {9}", | ||
450 | AgentID, m_udpServer.Scene.Name, resend, land, wind, cloud, task, texture, asset, total); | ||
451 | } | ||
356 | 452 | ||
357 | // Update the token buckets with new throttle values | 453 | // Update the token buckets with new throttle values |
454 | if (m_throttleClient.AdaptiveEnabled) | ||
455 | { | ||
456 | long total = resend + land + wind + cloud + task + texture + asset; | ||
457 | m_throttleClient.TargetDripRate = total; | ||
458 | } | ||
459 | |||
358 | TokenBucket bucket; | 460 | TokenBucket bucket; |
359 | 461 | ||
360 | bucket = m_throttleCategories[(int)ThrottleOutPacketType.Resend]; | 462 | bucket = m_throttleCategories[(int)ThrottleOutPacketType.Resend]; |
@@ -375,9 +477,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
375 | bucket = m_throttleCategories[(int)ThrottleOutPacketType.Task]; | 477 | bucket = m_throttleCategories[(int)ThrottleOutPacketType.Task]; |
376 | bucket.RequestedDripRate = task; | 478 | bucket.RequestedDripRate = task; |
377 | 479 | ||
378 | bucket = m_throttleCategories[(int)ThrottleOutPacketType.State]; | ||
379 | bucket.RequestedDripRate = state; | ||
380 | |||
381 | bucket = m_throttleCategories[(int)ThrottleOutPacketType.Texture]; | 480 | bucket = m_throttleCategories[(int)ThrottleOutPacketType.Texture]; |
382 | bucket.RequestedDripRate = texture; | 481 | bucket.RequestedDripRate = texture; |
383 | 482 | ||
@@ -620,15 +719,45 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
620 | /// <param name="categories">Throttle categories to fire the callback for</param> | 719 | /// <param name="categories">Throttle categories to fire the callback for</param> |
621 | private void BeginFireQueueEmpty(ThrottleOutPacketTypeFlags categories) | 720 | private void BeginFireQueueEmpty(ThrottleOutPacketTypeFlags categories) |
622 | { | 721 | { |
623 | if (m_nextOnQueueEmpty != 0 && (Environment.TickCount & Int32.MaxValue) >= m_nextOnQueueEmpty) | 722 | // if (m_nextOnQueueEmpty != 0 && (Environment.TickCount & Int32.MaxValue) >= m_nextOnQueueEmpty) |
723 | if (!m_isQueueEmptyRunning && (Environment.TickCount & Int32.MaxValue) >= m_nextOnQueueEmpty) | ||
624 | { | 724 | { |
725 | m_isQueueEmptyRunning = true; | ||
726 | |||
727 | int start = Environment.TickCount & Int32.MaxValue; | ||
728 | const int MIN_CALLBACK_MS = 30; | ||
729 | |||
730 | m_nextOnQueueEmpty = start + MIN_CALLBACK_MS; | ||
731 | if (m_nextOnQueueEmpty == 0) | ||
732 | m_nextOnQueueEmpty = 1; | ||
733 | |||
625 | // Use a value of 0 to signal that FireQueueEmpty is running | 734 | // Use a value of 0 to signal that FireQueueEmpty is running |
626 | m_nextOnQueueEmpty = 0; | 735 | // m_nextOnQueueEmpty = 0; |
627 | // Asynchronously run the callback | 736 | |
628 | Util.FireAndForget(FireQueueEmpty, categories); | 737 | m_categories = categories; |
738 | |||
739 | if (HasUpdates(m_categories)) | ||
740 | { | ||
741 | if (!m_udpServer.OqrEngine.IsRunning) | ||
742 | { | ||
743 | // Asynchronously run the callback | ||
744 | Util.FireAndForget(FireQueueEmpty, categories, "LLUDPClient.BeginFireQueueEmpty"); | ||
745 | } | ||
746 | else | ||
747 | { | ||
748 | m_udpServer.OqrEngine.QueueJob(AgentID.ToString(), () => FireQueueEmpty(categories)); | ||
749 | } | ||
750 | } | ||
751 | else | ||
752 | { | ||
753 | m_isQueueEmptyRunning = false; | ||
754 | } | ||
629 | } | 755 | } |
630 | } | 756 | } |
631 | 757 | ||
758 | private bool m_isQueueEmptyRunning; | ||
759 | private ThrottleOutPacketTypeFlags m_categories = 0; | ||
760 | |||
632 | /// <summary> | 761 | /// <summary> |
633 | /// Fires the OnQueueEmpty callback and sets the minimum time that it | 762 | /// Fires the OnQueueEmpty callback and sets the minimum time that it |
634 | /// can be called again | 763 | /// can be called again |
@@ -636,24 +765,35 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
636 | /// <param name="o">Throttle categories to fire the callback for, | 765 | /// <param name="o">Throttle categories to fire the callback for, |
637 | /// stored as an object to match the WaitCallback delegate | 766 | /// stored as an object to match the WaitCallback delegate |
638 | /// signature</param> | 767 | /// signature</param> |
639 | private void FireQueueEmpty(object o) | 768 | public void FireQueueEmpty(object o) |
640 | { | 769 | { |
641 | const int MIN_CALLBACK_MS = 30; | 770 | // m_log.DebugFormat("[LLUDPCLIENT]: FireQueueEmpty for {0} in {1}", AgentID, m_udpServer.Scene.Name); |
642 | 771 | ||
643 | ThrottleOutPacketTypeFlags categories = (ThrottleOutPacketTypeFlags)o; | 772 | // int start = Environment.TickCount & Int32.MaxValue; |
644 | QueueEmpty callback = OnQueueEmpty; | 773 | // const int MIN_CALLBACK_MS = 30; |
645 | |||
646 | int start = Environment.TickCount & Int32.MaxValue; | ||
647 | 774 | ||
648 | if (callback != null) | 775 | // if (m_udpServer.IsRunningOutbound) |
649 | { | 776 | // { |
650 | try { callback(categories); } | 777 | ThrottleOutPacketTypeFlags categories = (ThrottleOutPacketTypeFlags)o; |
651 | catch (Exception e) { m_log.Error("[LLUDPCLIENT]: OnQueueEmpty(" + categories + ") threw an exception: " + e.Message, e); } | 778 | QueueEmpty callback = OnQueueEmpty; |
652 | } | 779 | |
780 | if (callback != null) | ||
781 | { | ||
782 | // if (m_udpServer.IsRunningOutbound) | ||
783 | // { | ||
784 | try { callback(categories); } | ||
785 | catch (Exception e) { m_log.Error("[LLUDPCLIENT]: OnQueueEmpty(" + categories + ") threw an exception: " + e.Message, e); } | ||
786 | // } | ||
787 | } | ||
788 | // } | ||
789 | |||
790 | // m_nextOnQueueEmpty = start + MIN_CALLBACK_MS; | ||
791 | // if (m_nextOnQueueEmpty == 0) | ||
792 | // m_nextOnQueueEmpty = 1; | ||
793 | |||
794 | // } | ||
653 | 795 | ||
654 | m_nextOnQueueEmpty = start + MIN_CALLBACK_MS; | 796 | m_isQueueEmptyRunning = false; |
655 | if (m_nextOnQueueEmpty == 0) | ||
656 | m_nextOnQueueEmpty = 1; | ||
657 | } | 797 | } |
658 | 798 | ||
659 | /// <summary> | 799 | /// <summary> |
@@ -678,9 +818,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
678 | Texture = 5, | 818 | Texture = 5, |
679 | /// <summary>Non-texture assets</summary> | 819 | /// <summary>Non-texture assets</summary> |
680 | Asset = 6, | 820 | Asset = 6, |
681 | /// <summary>Avatar and primitive data</summary> | ||
682 | /// <remarks>This is a sub-category of Task</remarks> | ||
683 | State = 7, | ||
684 | */ | 821 | */ |
685 | 822 | ||
686 | switch (category) | 823 | switch (category) |
@@ -697,11 +834,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
697 | return ThrottleOutPacketTypeFlags.Texture; | 834 | return ThrottleOutPacketTypeFlags.Texture; |
698 | case ThrottleOutPacketType.Asset: | 835 | case ThrottleOutPacketType.Asset: |
699 | return ThrottleOutPacketTypeFlags.Asset; | 836 | return ThrottleOutPacketTypeFlags.Asset; |
700 | case ThrottleOutPacketType.State: | ||
701 | return ThrottleOutPacketTypeFlags.State; | ||
702 | default: | 837 | default: |
703 | return 0; | 838 | return 0; |
704 | } | 839 | } |
705 | } | 840 | } |
706 | } | 841 | } |
707 | } \ No newline at end of file | 842 | } |