aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorUbitUmarov2014-08-29 16:19:30 +0100
committerUbitUmarov2014-08-29 16:19:30 +0100
commit7351d92a76ac24edce848fe7410e920f17962101 (patch)
treed415c604bc0184caca3efc666a7de54862bd7c64 /OpenSim
parent reduce burst (diff)
downloadopensim-SC_OLD-7351d92a76ac24edce848fe7410e920f17962101.zip
opensim-SC_OLD-7351d92a76ac24edce848fe7410e920f17962101.tar.gz
opensim-SC_OLD-7351d92a76ac24edce848fe7410e920f17962101.tar.bz2
opensim-SC_OLD-7351d92a76ac24edce848fe7410e920f17962101.tar.xz
add method to get a category throttle rate
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Framework/IClientAPI.cs1
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs8
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs67
-rw-r--r--OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs5
-rw-r--r--OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs5
-rw-r--r--OpenSim/Tests/Common/Mock/TestClient.cs5
6 files changed, 53 insertions, 38 deletions
diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs
index d73802e..c386c95 100644
--- a/OpenSim/Framework/IClientAPI.cs
+++ b/OpenSim/Framework/IClientAPI.cs
@@ -1186,6 +1186,7 @@ namespace OpenSim.Framework
1186 void SetChildAgentThrottle(byte[] throttle); 1186 void SetChildAgentThrottle(byte[] throttle);
1187 1187
1188 void SetAgentThrottleSilent(int throttle, int setting); 1188 void SetAgentThrottleSilent(int throttle, int setting);
1189 int GetAgentThrottleSilent(int throttle);
1189 1190
1190 void SendAvatarDataImmediate(ISceneEntity avatar); 1191 void SendAvatarDataImmediate(ISceneEntity avatar);
1191 1192
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>
diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
index 2112b71..a45bea9 100644
--- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
+++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
@@ -1705,5 +1705,10 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
1705 public void SendPartFullUpdate(ISceneEntity ent, uint? parentID) 1705 public void SendPartFullUpdate(ISceneEntity ent, uint? parentID)
1706 { 1706 {
1707 } 1707 }
1708
1709 public int GetAgentThrottleSilent(int throttle)
1710 {
1711 return 0;
1712 }
1708 } 1713 }
1709} 1714}
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
index fa1d38a..cb87536 100644
--- a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
+++ b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
@@ -1276,5 +1276,10 @@ namespace OpenSim.Region.OptionalModules.World.NPC
1276 { 1276 {
1277 } 1277 }
1278 1278
1279 public int GetAgentThrottleSilent(int throttle)
1280 {
1281 return 0;
1282 }
1283
1279 } 1284 }
1280} 1285}
diff --git a/OpenSim/Tests/Common/Mock/TestClient.cs b/OpenSim/Tests/Common/Mock/TestClient.cs
index 2758030..00929df 100644
--- a/OpenSim/Tests/Common/Mock/TestClient.cs
+++ b/OpenSim/Tests/Common/Mock/TestClient.cs
@@ -548,6 +548,11 @@ namespace OpenSim.Tests.Common.Mock
548 { 548 {
549 } 549 }
550 550
551 public int GetAgentThrottleSilent(int throttle)
552 {
553 return 0;
554 }
555
551 public byte[] GetThrottlesPacked(float multiplier) 556 public byte[] GetThrottlesPacked(float multiplier)
552 { 557 {
553 return new byte[0]; 558 return new byte[0];