aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorteravus2012-11-05 13:10:00 -0500
committerteravus2012-11-05 13:10:00 -0500
commitb7b96a5e4f1e26341742e35e5253e6e14797bd15 (patch)
tree8aa01a8bc14fe80fa479f4e6bb7ff475816c6bd6
parentPipe Throttle Update Event to EventManager, client --> ScenePresence --> Even... (diff)
downloadopensim-SC-b7b96a5e4f1e26341742e35e5253e6e14797bd15.zip
opensim-SC-b7b96a5e4f1e26341742e35e5253e6e14797bd15.tar.gz
opensim-SC-b7b96a5e4f1e26341742e35e5253e6e14797bd15.tar.bz2
opensim-SC-b7b96a5e4f1e26341742e35e5253e6e14797bd15.tar.xz
Another step in the chain. Pipe the throttle update to the appropriate PollServiceTextureEventArgs. Each poll service having it's own throttle member is more consistent with the model then the region module keeping track of all of them globally and better for locking too. The Poll Services object is not set static to handle multiple nearby regions on the same simulator.
Next step is hooking it up to HasEvents
Diffstat (limited to '')
-rw-r--r--OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs6
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs47
2 files changed, 40 insertions, 13 deletions
diff --git a/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs b/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs
index b3a4d61..86e7aa0 100644
--- a/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs
+++ b/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs
@@ -68,7 +68,7 @@ namespace OpenSim.Capabilities.Handlers
68 ret["content_type"] = "text/plain"; 68 ret["content_type"] = "text/plain";
69 ret["keepalive"] = false; 69 ret["keepalive"] = false;
70 ret["reusecontext"] = false; 70 ret["reusecontext"] = false;
71 71 ret["int_bytes"] = 0;
72 string textureStr = (string)request["texture_id"]; 72 string textureStr = (string)request["texture_id"];
73 string format = (string)request["format"]; 73 string format = (string)request["format"];
74 74
@@ -223,6 +223,7 @@ namespace OpenSim.Capabilities.Handlers
223 { 223 {
224 response["int_response_code"] = (int)System.Net.HttpStatusCode.OK; 224 response["int_response_code"] = (int)System.Net.HttpStatusCode.OK;
225 response["bin_response_data"] = texture.Data; 225 response["bin_response_data"] = texture.Data;
226 response["int_bytes"] = texture.Data.Length;
226 } 227 }
227 else 228 else
228 { 229 {
@@ -232,6 +233,7 @@ namespace OpenSim.Capabilities.Handlers
232 byte[] d = new byte[len]; 233 byte[] d = new byte[len];
233 Array.Copy(texture.Data, start, d, 0, len); 234 Array.Copy(texture.Data, start, d, 0, len);
234 response["bin_response_data"] = d; 235 response["bin_response_data"] = d;
236 response["int_bytes"] = len;
235 } 237 }
236// response.Body.Write(texture.Data, start, len); 238// response.Body.Write(texture.Data, start, len);
237 } 239 }
@@ -252,6 +254,8 @@ namespace OpenSim.Capabilities.Handlers
252 response["content_type"] = "image/" + format; 254 response["content_type"] = "image/" + format;
253 255
254 response["bin_response_data"] = texture.Data; 256 response["bin_response_data"] = texture.Data;
257 response["int_bytes"] = texture.Data.Length;
258
255// response.Body.Write(texture.Data, 0, texture.Data.Length); 259// response.Body.Write(texture.Data, 0, texture.Data.Length);
256 } 260 }
257 261
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()