diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs | 47 |
1 files changed, 35 insertions, 12 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs index 19d4b91..4bfdbff 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs | |||
@@ -61,6 +61,13 @@ namespace OpenSim.Region.ClientStack.Linden | |||
61 | public Hashtable request; | 61 | public Hashtable request; |
62 | } | 62 | } |
63 | 63 | ||
64 | public struct aPollResponse | ||
65 | { | ||
66 | public Hashtable response; | ||
67 | public int bytes; | ||
68 | } | ||
69 | |||
70 | |||
64 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 71 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
65 | 72 | ||
66 | private Scene m_scene; | 73 | private Scene m_scene; |
@@ -75,6 +82,8 @@ namespace OpenSim.Region.ClientStack.Linden | |||
75 | private static OpenMetaverse.BlockingQueue<aPollRequest> m_queue = | 82 | private static OpenMetaverse.BlockingQueue<aPollRequest> m_queue = |
76 | new OpenMetaverse.BlockingQueue<aPollRequest>(); | 83 | new OpenMetaverse.BlockingQueue<aPollRequest>(); |
77 | 84 | ||
85 | private Dictionary<UUID,PollServiceTextureEventArgs> m_pollservices = new Dictionary<UUID,PollServiceTextureEventArgs>(); | ||
86 | |||
78 | #region ISharedRegionModule Members | 87 | #region ISharedRegionModule Members |
79 | 88 | ||
80 | public void Initialise(IConfigSource source) | 89 | public void Initialise(IConfigSource source) |
@@ -147,7 +156,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
147 | // int wind = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4; | 156 | // int wind = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4; |
148 | // int cloud = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4; | 157 | // int cloud = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4; |
149 | // int task = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4; | 158 | // int task = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4; |
150 | pos = pos + 16; | 159 | pos = pos + 20; |
151 | int texture = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4; | 160 | int texture = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4; |
152 | //int asset = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); | 161 | //int asset = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); |
153 | return texture; | 162 | return texture; |
@@ -159,6 +168,11 @@ namespace OpenSim.Region.ClientStack.Linden | |||
159 | byte[] throttles = p.ControllingClient.GetThrottlesPacked(1); | 168 | byte[] throttles = p.ControllingClient.GetThrottlesPacked(1); |
160 | UUID user = p.UUID; | 169 | UUID user = p.UUID; |
161 | int imagethrottle = ExtractImageThrottle(throttles); | 170 | int imagethrottle = ExtractImageThrottle(throttles); |
171 | PollServiceTextureEventArgs args; | ||
172 | if (m_pollservices.TryGetValue(user,out args)) | ||
173 | { | ||
174 | args.UpdateThrottle(imagethrottle); | ||
175 | } | ||
162 | } | 176 | } |
163 | 177 | ||
164 | public void PostInitialise() | 178 | public void PostInitialise() |
@@ -187,8 +201,8 @@ namespace OpenSim.Region.ClientStack.Linden | |||
187 | { | 201 | { |
188 | private List<Hashtable> requests = | 202 | private List<Hashtable> requests = |
189 | new List<Hashtable>(); | 203 | new List<Hashtable>(); |
190 | private Dictionary<UUID, Hashtable> responses = | 204 | private Dictionary<UUID, aPollResponse> responses = |
191 | new Dictionary<UUID, Hashtable>(); | 205 | new Dictionary<UUID, aPollResponse>(); |
192 | 206 | ||
193 | private Scene m_scene; | 207 | private Scene m_scene; |
194 | 208 | ||
@@ -196,7 +210,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
196 | base(null, null, null, null, pId, int.MaxValue) | 210 | base(null, null, null, null, pId, int.MaxValue) |
197 | { | 211 | { |
198 | m_scene = scene; | 212 | m_scene = scene; |
199 | 213 | // x is request id, y is userid | |
200 | HasEvents = (x, y) => | 214 | HasEvents = (x, y) => |
201 | { | 215 | { |
202 | lock (responses) | 216 | lock (responses) |
@@ -208,7 +222,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
208 | { | 222 | { |
209 | try | 223 | try |
210 | { | 224 | { |
211 | return responses[x]; | 225 | return responses[x].response; |
212 | } | 226 | } |
213 | finally | 227 | finally |
214 | { | 228 | { |
@@ -216,14 +230,14 @@ namespace OpenSim.Region.ClientStack.Linden | |||
216 | } | 230 | } |
217 | } | 231 | } |
218 | }; | 232 | }; |
219 | 233 | // x is request id, y is request data hashtable | |
220 | Request = (x, y) => | 234 | Request = (x, y) => |
221 | { | 235 | { |
222 | aPollRequest reqinfo = new aPollRequest(); | 236 | aPollRequest reqinfo = new aPollRequest(); |
223 | reqinfo.thepoll = this; | 237 | reqinfo.thepoll = this; |
224 | reqinfo.reqID = x; | 238 | reqinfo.reqID = x; |
225 | reqinfo.request = y; | 239 | reqinfo.request = y; |
226 | 240 | ||
227 | m_queue.Enqueue(reqinfo); | 241 | m_queue.Enqueue(reqinfo); |
228 | }; | 242 | }; |
229 | 243 | ||
@@ -265,16 +279,21 @@ namespace OpenSim.Region.ClientStack.Linden | |||
265 | response["content_type"] = "text/plain"; | 279 | response["content_type"] = "text/plain"; |
266 | response["keepalive"] = false; | 280 | response["keepalive"] = false; |
267 | response["reusecontext"] = false; | 281 | response["reusecontext"] = false; |
268 | 282 | ||
269 | lock (responses) | 283 | lock (responses) |
270 | responses[requestID] = response; | 284 | responses[requestID] = new aPollResponse() {bytes = 0,response = response}; |
271 | 285 | ||
272 | return; | 286 | return; |
273 | } | 287 | } |
274 | 288 | ||
275 | response = m_getTextureHandler.Handle(requestinfo.request); | 289 | response = m_getTextureHandler.Handle(requestinfo.request); |
276 | lock (responses) | 290 | lock (responses) |
277 | responses[requestID] = response; | 291 | responses[requestID] = new aPollResponse() { bytes = (int)response["int_bytes"], response = response}; |
292 | } | ||
293 | |||
294 | internal void UpdateThrottle(int pimagethrottle) | ||
295 | { | ||
296 | |||
278 | } | 297 | } |
279 | } | 298 | } |
280 | 299 | ||
@@ -299,19 +318,23 @@ namespace OpenSim.Region.ClientStack.Linden | |||
299 | protocol = "https"; | 318 | protocol = "https"; |
300 | } | 319 | } |
301 | caps.RegisterHandler("GetTexture", String.Format("{0}://{1}:{2}{3}", protocol, hostName, port, capUrl)); | 320 | caps.RegisterHandler("GetTexture", String.Format("{0}://{1}:{2}{3}", protocol, hostName, port, capUrl)); |
302 | 321 | m_pollservices.Add(agentID, args); | |
303 | m_capsDict[agentID] = capUrl; | 322 | m_capsDict[agentID] = capUrl; |
304 | } | 323 | } |
305 | 324 | ||
306 | private void DeregisterCaps(UUID agentID, Caps caps) | 325 | private void DeregisterCaps(UUID agentID, Caps caps) |
307 | { | 326 | { |
308 | string capUrl; | 327 | string capUrl; |
309 | 328 | PollServiceTextureEventArgs args; | |
310 | if (m_capsDict.TryGetValue(agentID, out capUrl)) | 329 | if (m_capsDict.TryGetValue(agentID, out capUrl)) |
311 | { | 330 | { |
312 | MainServer.Instance.RemoveHTTPHandler("", capUrl); | 331 | MainServer.Instance.RemoveHTTPHandler("", capUrl); |
313 | m_capsDict.Remove(agentID); | 332 | m_capsDict.Remove(agentID); |
314 | } | 333 | } |
334 | if (m_pollservices.TryGetValue(agentID, out args)) | ||
335 | { | ||
336 | m_pollservices.Remove(agentID); | ||
337 | } | ||
315 | } | 338 | } |
316 | 339 | ||
317 | private void DoTextureRequests() | 340 | private void DoTextureRequests() |