diff options
Diffstat (limited to 'OpenSim/Region/ClientStack/Linden/UDP')
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 8 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs | 67 |
2 files changed, 37 insertions, 38 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 7227964..12ee3b2 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | |||
@@ -12306,16 +12306,18 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
12306 | } | 12306 | } |
12307 | 12307 | ||
12308 | /// <summary> | 12308 | /// <summary> |
12309 | /// Sets the throttles from values supplied by the client | 12309 | /// Sets the throttles from values supplied caller |
12310 | /// </summary> | 12310 | /// </summary> |
12311 | /// <param name="throttles"></param> | 12311 | /// <param name="throttles"></param> |
12312 | public void SetAgentThrottleSilent(int throttle, int setting) | 12312 | public void SetAgentThrottleSilent(int throttle, int setting) |
12313 | { | 12313 | { |
12314 | m_udpClient.ForceThrottleSetting(throttle,setting); | 12314 | m_udpClient.ForceThrottleSetting(throttle,setting); |
12315 | //m_udpClient.SetThrottles(throttles); | ||
12316 | |||
12317 | } | 12315 | } |
12318 | 12316 | ||
12317 | public int GetAgentThrottleSilent(int throttle) | ||
12318 | { | ||
12319 | return m_udpClient.GetThrottleSetting(throttle); | ||
12320 | } | ||
12319 | 12321 | ||
12320 | /// <summary> | 12322 | /// <summary> |
12321 | /// Get the current throttles for this client as a packed byte array | 12323 | /// Get the current throttles for this client as a packed byte array |
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs index 89a9401..f91abfe 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs | |||
@@ -688,6 +688,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
688 | RTO = Math.Min(RTO * 2, m_maxRTO); | 688 | RTO = Math.Min(RTO * 2, m_maxRTO); |
689 | } | 689 | } |
690 | 690 | ||
691 | |||
692 | const int MIN_CALLBACK_MS = 30; | ||
693 | |||
691 | /// <summary> | 694 | /// <summary> |
692 | /// Does an early check to see if this queue empty callback is already | 695 | /// Does an early check to see if this queue empty callback is already |
693 | /// running, then asynchronously firing the event | 696 | /// running, then asynchronously firing the event |
@@ -695,24 +698,20 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
695 | /// <param name="categories">Throttle categories to fire the callback for</param> | 698 | /// <param name="categories">Throttle categories to fire the callback for</param> |
696 | private void BeginFireQueueEmpty(ThrottleOutPacketTypeFlags categories) | 699 | private void BeginFireQueueEmpty(ThrottleOutPacketTypeFlags categories) |
697 | { | 700 | { |
698 | // if (m_nextOnQueueEmpty != 0 && (Environment.TickCount & Int32.MaxValue) >= m_nextOnQueueEmpty) | 701 | if (!m_isQueueEmptyRunning) |
699 | if (!m_isQueueEmptyRunning && (Environment.TickCount & Int32.MaxValue) >= m_nextOnQueueEmpty) | ||
700 | { | 702 | { |
701 | m_isQueueEmptyRunning = true; | ||
702 | |||
703 | int start = Environment.TickCount & Int32.MaxValue; | 703 | int start = Environment.TickCount & Int32.MaxValue; |
704 | const int MIN_CALLBACK_MS = 30; | 704 | |
705 | if (start < m_nextOnQueueEmpty) | ||
706 | return; | ||
707 | |||
708 | m_isQueueEmptyRunning = true; | ||
705 | 709 | ||
706 | m_nextOnQueueEmpty = start + MIN_CALLBACK_MS; | 710 | m_nextOnQueueEmpty = start + MIN_CALLBACK_MS; |
707 | if (m_nextOnQueueEmpty == 0) | 711 | if (m_nextOnQueueEmpty == 0) |
708 | m_nextOnQueueEmpty = 1; | 712 | m_nextOnQueueEmpty = 1; |
709 | 713 | ||
710 | // Use a value of 0 to signal that FireQueueEmpty is running | 714 | if (HasUpdates(categories)) |
711 | // m_nextOnQueueEmpty = 0; | ||
712 | |||
713 | m_categories = categories; | ||
714 | |||
715 | if (HasUpdates(m_categories)) | ||
716 | { | 715 | { |
717 | // Asynchronously run the callback | 716 | // Asynchronously run the callback |
718 | Util.FireAndForget(FireQueueEmpty, categories); | 717 | Util.FireAndForget(FireQueueEmpty, categories); |
@@ -725,7 +724,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
725 | } | 724 | } |
726 | 725 | ||
727 | private bool m_isQueueEmptyRunning; | 726 | private bool m_isQueueEmptyRunning; |
728 | private ThrottleOutPacketTypeFlags m_categories = 0; | 727 | |
729 | 728 | ||
730 | /// <summary> | 729 | /// <summary> |
731 | /// Fires the OnQueueEmpty callback and sets the minimum time that it | 730 | /// Fires the OnQueueEmpty callback and sets the minimum time that it |
@@ -736,35 +735,33 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
736 | /// signature</param> | 735 | /// signature</param> |
737 | private void FireQueueEmpty(object o) | 736 | private void FireQueueEmpty(object o) |
738 | { | 737 | { |
739 | // int start = Environment.TickCount & Int32.MaxValue; | 738 | ThrottleOutPacketTypeFlags categories = (ThrottleOutPacketTypeFlags)o; |
740 | // const int MIN_CALLBACK_MS = 30; | 739 | QueueEmpty callback = OnQueueEmpty; |
741 | |||
742 | // if (m_udpServer.IsRunningOutbound) | ||
743 | // { | ||
744 | ThrottleOutPacketTypeFlags categories = (ThrottleOutPacketTypeFlags)o; | ||
745 | QueueEmpty callback = OnQueueEmpty; | ||
746 | 740 | ||
747 | if (callback != null) | 741 | if (callback != null) |
748 | { | 742 | { |
749 | // if (m_udpServer.IsRunningOutbound) | 743 | // if (m_udpServer.IsRunningOutbound) |
750 | // { | 744 | // { |
751 | try { callback(categories); } | 745 | try { callback(categories); } |
752 | catch (Exception e) { m_log.Error("[LLUDPCLIENT]: OnQueueEmpty(" + categories + ") threw an exception: " + e.Message, e); } | 746 | catch (Exception e) { m_log.Error("[LLUDPCLIENT]: OnQueueEmpty(" + categories + ") threw an exception: " + e.Message, e); } |
753 | // } | 747 | // } |
754 | } | 748 | } |
755 | // } | ||
756 | |||
757 | // m_nextOnQueueEmpty = start + MIN_CALLBACK_MS; | ||
758 | // if (m_nextOnQueueEmpty == 0) | ||
759 | // m_nextOnQueueEmpty = 1; | ||
760 | |||
761 | // } | ||
762 | 749 | ||
763 | m_isQueueEmptyRunning = false; | 750 | m_isQueueEmptyRunning = false; |
764 | } | 751 | } |
752 | |||
765 | internal void ForceThrottleSetting(int throttle, int setting) | 753 | internal void ForceThrottleSetting(int throttle, int setting) |
766 | { | 754 | { |
767 | m_throttleCategories[throttle].RequestedDripRate = Math.Max(setting, LLUDPServer.MTU); ; | 755 | if (throttle > 0 && throttle < THROTTLE_CATEGORY_COUNT) |
756 | m_throttleCategories[throttle].RequestedDripRate = Math.Max(setting, LLUDPServer.MTU); | ||
757 | } | ||
758 | |||
759 | internal int GetThrottleSetting(int throttle) | ||
760 | { | ||
761 | if (throttle > 0 && throttle < THROTTLE_CATEGORY_COUNT) | ||
762 | return (int)m_throttleCategories[throttle].RequestedDripRate; | ||
763 | else | ||
764 | return 0; | ||
768 | } | 765 | } |
769 | 766 | ||
770 | /// <summary> | 767 | /// <summary> |