aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorteravus2012-11-04 22:57:24 -0500
committerteravus2012-11-04 22:57:24 -0500
commit4fa088bafb4c78ad3177b0e944a4312bd6abdea7 (patch)
treed6ff3e82c2e5502fc57eec819dc9e97752030c27 /OpenSim
parentPrevent IMs being sent to prims when avies decline inventory offers from them. (diff)
downloadopensim-SC-4fa088bafb4c78ad3177b0e944a4312bd6abdea7.zip
opensim-SC-4fa088bafb4c78ad3177b0e944a4312bd6abdea7.tar.gz
opensim-SC-4fa088bafb4c78ad3177b0e944a4312bd6abdea7.tar.bz2
opensim-SC-4fa088bafb4c78ad3177b0e944a4312bd6abdea7.tar.xz
Pipe Throttle Update Event to EventManager, client --> ScenePresence --> EventManager, so that modules can know when throttles are updated. The event contains no client specific data to preserve the possibility of 'multiple clients' and you must still call ControllingClient.GetThrottlesPacked(f) to see what the throttles actually are once the event fires. Hook EventManager.OnUpdateThrottle to GetTextureModule.
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Framework/IClientAPI.cs2
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs42
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs11
-rw-r--r--OpenSim/Region/Framework/Scenes/EventManager.cs13
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs5
-rw-r--r--OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs1
-rw-r--r--OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs2
-rw-r--r--OpenSim/Tests/Common/Mock/TestClient.cs2
8 files changed, 75 insertions, 3 deletions
diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs
index 5909ce1..e31c7f6 100644
--- a/OpenSim/Framework/IClientAPI.cs
+++ b/OpenSim/Framework/IClientAPI.cs
@@ -1038,7 +1038,7 @@ namespace OpenSim.Framework
1038 event MuteListEntryRemove OnRemoveMuteListEntry; 1038 event MuteListEntryRemove OnRemoveMuteListEntry;
1039 event GodlikeMessage onGodlikeMessage; 1039 event GodlikeMessage onGodlikeMessage;
1040 event GodUpdateRegionInfoUpdate OnGodUpdateRegionInfoUpdate; 1040 event GodUpdateRegionInfoUpdate OnGodUpdateRegionInfoUpdate;
1041 1041 event GenericCall2 OnUpdateThrottles;
1042 /// <summary> 1042 /// <summary>
1043 /// Set the debug level at which packet output should be printed to console. 1043 /// Set the debug level at which packet output should be printed to console.
1044 /// </summary> 1044 /// </summary>
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs
index d1a1583..19d4b91 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs
@@ -91,6 +91,7 @@ namespace OpenSim.Region.ClientStack.Linden
91 { 91 {
92 m_scene.EventManager.OnRegisterCaps -= RegisterCaps; 92 m_scene.EventManager.OnRegisterCaps -= RegisterCaps;
93 m_scene.EventManager.OnDeregisterCaps -= DeregisterCaps; 93 m_scene.EventManager.OnDeregisterCaps -= DeregisterCaps;
94 m_scene.EventManager.OnThrottleUpdate -= ThrottleUpdate;
94 m_scene = null; 95 m_scene = null;
95 } 96 }
96 97
@@ -101,6 +102,7 @@ namespace OpenSim.Region.ClientStack.Linden
101 102
102 m_scene.EventManager.OnRegisterCaps += RegisterCaps; 103 m_scene.EventManager.OnRegisterCaps += RegisterCaps;
103 m_scene.EventManager.OnDeregisterCaps += DeregisterCaps; 104 m_scene.EventManager.OnDeregisterCaps += DeregisterCaps;
105 m_scene.EventManager.OnThrottleUpdate += ThrottleUpdate;
104 106
105 if (m_workerThreads == null) 107 if (m_workerThreads == null)
106 { 108 {
@@ -118,6 +120,46 @@ namespace OpenSim.Region.ClientStack.Linden
118 } 120 }
119 } 121 }
120 } 122 }
123 private int ExtractImageThrottle(byte[] pthrottles)
124 {
125
126 byte[] adjData;
127 int pos = 0;
128
129 if (!BitConverter.IsLittleEndian)
130 {
131 byte[] newData = new byte[7 * 4];
132 Buffer.BlockCopy(pthrottles, 0, newData, 0, 7 * 4);
133
134 for (int i = 0; i < 7; i++)
135 Array.Reverse(newData, i * 4, 4);
136
137 adjData = newData;
138 }
139 else
140 {
141 adjData = pthrottles;
142 }
143
144 // 0.125f converts from bits to bytes
145 //int resend = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4;
146 // int land = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4;
147 // int wind = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4;
148 // int cloud = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4;
149 // int task = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4;
150 pos = pos + 16;
151 int texture = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4;
152 //int asset = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f);
153 return texture;
154 }
155
156 // Now we know when the throttle is changed by the client in the case of a root agent or by a neighbor region in the case of a child agent.
157 public void ThrottleUpdate(ScenePresence p)
158 {
159 byte[] throttles = p.ControllingClient.GetThrottlesPacked(1);
160 UUID user = p.UUID;
161 int imagethrottle = ExtractImageThrottle(throttles);
162 }
121 163
122 public void PostInitialise() 164 public void PostInitialise()
123 { 165 {
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
index ee28914..ae9ed7f 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
@@ -295,6 +295,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
295 public event MuteListEntryRemove OnRemoveMuteListEntry; 295 public event MuteListEntryRemove OnRemoveMuteListEntry;
296 public event GodlikeMessage onGodlikeMessage; 296 public event GodlikeMessage onGodlikeMessage;
297 public event GodUpdateRegionInfoUpdate OnGodUpdateRegionInfoUpdate; 297 public event GodUpdateRegionInfoUpdate OnGodUpdateRegionInfoUpdate;
298 public event GenericCall2 OnUpdateThrottles;
298 299
299 #endregion Events 300 #endregion Events
300 301
@@ -6729,6 +6730,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
6729 #endregion 6730 #endregion
6730 6731
6731 m_udpClient.SetThrottles(atpack.Throttle.Throttles); 6732 m_udpClient.SetThrottles(atpack.Throttle.Throttles);
6733 GenericCall2 handler = OnUpdateThrottles;
6734 if (handler != null)
6735 {
6736 handler();
6737 }
6732 return true; 6738 return true;
6733 } 6739 }
6734 6740
@@ -11870,6 +11876,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
11870 public void SetChildAgentThrottle(byte[] throttles) 11876 public void SetChildAgentThrottle(byte[] throttles)
11871 { 11877 {
11872 m_udpClient.SetThrottles(throttles); 11878 m_udpClient.SetThrottles(throttles);
11879 GenericCall2 handler = OnUpdateThrottles;
11880 if (handler != null)
11881 {
11882 handler();
11883 }
11873 } 11884 }
11874 11885
11875 /// <summary> 11886 /// <summary>
diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs
index 7916c42..4a19c3b 100644
--- a/OpenSim/Region/Framework/Scenes/EventManager.cs
+++ b/OpenSim/Region/Framework/Scenes/EventManager.cs
@@ -376,6 +376,10 @@ namespace OpenSim.Region.Framework.Scenes
376 public event ParcelPrimCountTainted OnParcelPrimCountTainted; 376 public event ParcelPrimCountTainted OnParcelPrimCountTainted;
377 public event GetScriptRunning OnGetScriptRunning; 377 public event GetScriptRunning OnGetScriptRunning;
378 378
379 public delegate void ThrottleUpdate(ScenePresence scenePresence);
380
381 public event ThrottleUpdate OnThrottleUpdate;
382
379 /// <summary> 383 /// <summary>
380 /// RegisterCapsEvent is called by Scene after the Caps object 384 /// RegisterCapsEvent is called by Scene after the Caps object
381 /// has been instantiated and before it is return to the 385 /// has been instantiated and before it is return to the
@@ -2641,5 +2645,14 @@ namespace OpenSim.Region.Framework.Scenes
2641 } 2645 }
2642 } 2646 }
2643 } 2647 }
2648
2649 public void TriggerThrottleUpdate(ScenePresence scenePresence)
2650 {
2651 ThrottleUpdate handler = OnThrottleUpdate;
2652 if (handler != null)
2653 {
2654 handler(scenePresence);
2655 }
2656 }
2644 } 2657 }
2645} 2658}
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index a8aa551..2b9665c 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -793,6 +793,7 @@ namespace OpenSim.Region.Framework.Scenes
793 ControllingClient.OnChangeAnim += avnHandleChangeAnim; 793 ControllingClient.OnChangeAnim += avnHandleChangeAnim;
794 ControllingClient.OnForceReleaseControls += HandleForceReleaseControls; 794 ControllingClient.OnForceReleaseControls += HandleForceReleaseControls;
795 ControllingClient.OnAutoPilotGo += MoveToTarget; 795 ControllingClient.OnAutoPilotGo += MoveToTarget;
796 ControllingClient.OnUpdateThrottles += RaiseUpdateThrottles;
796 797
797 // ControllingClient.OnChildAgentStatus += new StatusChange(this.ChildStatusChange); 798 // ControllingClient.OnChildAgentStatus += new StatusChange(this.ChildStatusChange);
798 // ControllingClient.OnStopMovement += new GenericCall2(this.StopMovement); 799 // ControllingClient.OnStopMovement += new GenericCall2(this.StopMovement);
@@ -3166,6 +3167,10 @@ namespace OpenSim.Region.Framework.Scenes
3166 } 3167 }
3167 3168
3168 private static Vector3 marker = new Vector3(-1f, -1f, -1f); 3169 private static Vector3 marker = new Vector3(-1f, -1f, -1f);
3170 private void RaiseUpdateThrottles()
3171 {
3172 m_scene.EventManager.TriggerThrottleUpdate(this);
3173 }
3169 /// <summary> 3174 /// <summary>
3170 /// This updates important decision making data about a child agent 3175 /// This updates important decision making data about a child agent
3171 /// The main purpose is to figure out what objects to send to a child agent that's in a neighboring region 3176 /// The main purpose is to figure out what objects to send to a child agent that's in a neighboring region
diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
index a484300..28b8293 100644
--- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
+++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
@@ -873,6 +873,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
873 public event MuteListEntryRemove OnRemoveMuteListEntry; 873 public event MuteListEntryRemove OnRemoveMuteListEntry;
874 public event GodlikeMessage onGodlikeMessage; 874 public event GodlikeMessage onGodlikeMessage;
875 public event GodUpdateRegionInfoUpdate OnGodUpdateRegionInfoUpdate; 875 public event GodUpdateRegionInfoUpdate OnGodUpdateRegionInfoUpdate;
876 public event GenericCall2 OnUpdateThrottles;
876 877
877#pragma warning restore 67 878#pragma warning restore 67
878 879
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
index 7c693b6..6c8e2fc 100644
--- a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
+++ b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
@@ -473,7 +473,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC
473 public event MuteListEntryRemove OnRemoveMuteListEntry; 473 public event MuteListEntryRemove OnRemoveMuteListEntry;
474 public event GodlikeMessage onGodlikeMessage; 474 public event GodlikeMessage onGodlikeMessage;
475 public event GodUpdateRegionInfoUpdate OnGodUpdateRegionInfoUpdate; 475 public event GodUpdateRegionInfoUpdate OnGodUpdateRegionInfoUpdate;
476 476 public event GenericCall2 OnUpdateThrottles;
477#pragma warning restore 67 477#pragma warning restore 67
478 478
479 #endregion 479 #endregion
diff --git a/OpenSim/Tests/Common/Mock/TestClient.cs b/OpenSim/Tests/Common/Mock/TestClient.cs
index 49a8d26..78bb18e 100644
--- a/OpenSim/Tests/Common/Mock/TestClient.cs
+++ b/OpenSim/Tests/Common/Mock/TestClient.cs
@@ -320,7 +320,7 @@ namespace OpenSim.Tests.Common.Mock
320 public event MuteListEntryRemove OnRemoveMuteListEntry; 320 public event MuteListEntryRemove OnRemoveMuteListEntry;
321 public event GodlikeMessage onGodlikeMessage; 321 public event GodlikeMessage onGodlikeMessage;
322 public event GodUpdateRegionInfoUpdate OnGodUpdateRegionInfoUpdate; 322 public event GodUpdateRegionInfoUpdate OnGodUpdateRegionInfoUpdate;
323 323 public event GenericCall2 OnUpdateThrottles;
324#pragma warning restore 67 324#pragma warning restore 67
325 325
326 /// <value> 326 /// <value>