aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack/Linden
diff options
context:
space:
mode:
authorteravus2012-11-04 22:57:24 -0500
committerteravus2012-11-04 22:57:24 -0500
commit4fa088bafb4c78ad3177b0e944a4312bd6abdea7 (patch)
treed6ff3e82c2e5502fc57eec819dc9e97752030c27 /OpenSim/Region/ClientStack/Linden
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/Region/ClientStack/Linden')
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs42
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs11
2 files changed, 53 insertions, 0 deletions
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>