aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Framework/Console/RemoteConsole.cs11
-rw-r--r--OpenSim/Framework/Servers/HttpServer/PollServiceEventArgs.cs5
-rw-r--r--OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs95
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs6
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs11
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs6
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs4
-rw-r--r--OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs26
8 files changed, 123 insertions, 41 deletions
diff --git a/OpenSim/Framework/Console/RemoteConsole.cs b/OpenSim/Framework/Console/RemoteConsole.cs
index 8ad7b0d..4b88923 100644
--- a/OpenSim/Framework/Console/RemoteConsole.cs
+++ b/OpenSim/Framework/Console/RemoteConsole.cs
@@ -234,7 +234,7 @@ namespace OpenSim.Framework.Console
234 string uri = "/ReadResponses/" + sessionID.ToString() + "/"; 234 string uri = "/ReadResponses/" + sessionID.ToString() + "/";
235 235
236 m_Server.AddPollServiceHTTPHandler( 236 m_Server.AddPollServiceHTTPHandler(
237 uri, new PollServiceEventArgs(null, uri, HasEvents, GetEvents, NoEvents, sessionID,25000)); // 25 secs timeout 237 uri, new PollServiceEventArgs(null, uri, HasEvents, GetEvents, NoEvents, Drop, sessionID, 25000)); // 25 secs timeout
238 238
239 XmlDocument xmldoc = new XmlDocument(); 239 XmlDocument xmldoc = new XmlDocument();
240 XmlNode xmlnode = xmldoc.CreateNode(XmlNodeType.XmlDeclaration, 240 XmlNode xmlnode = xmldoc.CreateNode(XmlNodeType.XmlDeclaration,
@@ -425,6 +425,15 @@ namespace OpenSim.Framework.Console
425 return false; 425 return false;
426 } 426 }
427 427
428 private void Drop(UUID RequestID, UUID sessionID)
429 {
430 lock (m_Connections)
431 {
432 if (m_Connections.ContainsKey(sessionID))
433 m_Connections.Remove(sessionID);
434 }
435 }
436
428 private Hashtable GetEvents(UUID RequestID, UUID sessionID) 437 private Hashtable GetEvents(UUID RequestID, UUID sessionID)
429 { 438 {
430 ConsoleConnection c = null; 439 ConsoleConnection c = null;
diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceEventArgs.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceEventArgs.cs
index 3fd3bf7..a9860cc 100644
--- a/OpenSim/Framework/Servers/HttpServer/PollServiceEventArgs.cs
+++ b/OpenSim/Framework/Servers/HttpServer/PollServiceEventArgs.cs
@@ -37,6 +37,7 @@ namespace OpenSim.Framework.Servers.HttpServer
37 public delegate Hashtable GetEventsMethod(UUID requestID, UUID pId); 37 public delegate Hashtable GetEventsMethod(UUID requestID, UUID pId);
38 38
39 public delegate Hashtable NoEventsMethod(UUID requestID, UUID pId); 39 public delegate Hashtable NoEventsMethod(UUID requestID, UUID pId);
40 public delegate void DropMethod(UUID requestID, UUID pId);
40 41
41 public class PollServiceEventArgs : EventArgs 42 public class PollServiceEventArgs : EventArgs
42 { 43 {
@@ -44,6 +45,7 @@ namespace OpenSim.Framework.Servers.HttpServer
44 public GetEventsMethod GetEvents; 45 public GetEventsMethod GetEvents;
45 public NoEventsMethod NoEvents; 46 public NoEventsMethod NoEvents;
46 public RequestMethod Request; 47 public RequestMethod Request;
48 public DropMethod Drop;
47 public UUID Id; 49 public UUID Id;
48 public int TimeOutms; 50 public int TimeOutms;
49 public EventType Type; 51 public EventType Type;
@@ -73,13 +75,14 @@ namespace OpenSim.Framework.Servers.HttpServer
73 RequestMethod pRequest, 75 RequestMethod pRequest,
74 string pUrl, 76 string pUrl,
75 HasEventsMethod pHasEvents, GetEventsMethod pGetEvents, NoEventsMethod pNoEvents, 77 HasEventsMethod pHasEvents, GetEventsMethod pGetEvents, NoEventsMethod pNoEvents,
76 UUID pId, int pTimeOutms) 78 DropMethod pDrop, UUID pId, int pTimeOutms)
77 { 79 {
78 Request = pRequest; 80 Request = pRequest;
79 Url = pUrl; 81 Url = pUrl;
80 HasEvents = pHasEvents; 82 HasEvents = pHasEvents;
81 GetEvents = pGetEvents; 83 GetEvents = pGetEvents;
82 NoEvents = pNoEvents; 84 NoEvents = pNoEvents;
85 Drop = pDrop;
83 Id = pId; 86 Id = pId;
84 TimeOutms = pTimeOutms; 87 TimeOutms = pTimeOutms;
85 Type = EventType.LongPoll; 88 Type = EventType.LongPoll;
diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs
index ffcad0f..5b40590 100644
--- a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs
+++ b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs
@@ -160,6 +160,19 @@ namespace OpenSim.Framework.Servers.HttpServer
160 } 160 }
161 } 161 }
162 162
163 public void DropByContext(PollServiceHttpRequest req)
164 {
165 Queue<PollServiceHttpRequest> ctxQeueue;
166 lock (m_bycontext)
167 {
168 if (m_bycontext.TryGetValue(req, out ctxQeueue))
169 {
170 ctxQeueue.Clear();
171 m_bycontext.Remove(req);
172 }
173 }
174 }
175
163 public void EnqueueInt(PollServiceHttpRequest req) 176 public void EnqueueInt(PollServiceHttpRequest req)
164 { 177 {
165 if (m_running) 178 if (m_running)
@@ -263,22 +276,61 @@ namespace OpenSim.Framework.Servers.HttpServer
263 PollServiceHttpRequest req = m_requests.Dequeue(5000); 276 PollServiceHttpRequest req = m_requests.Dequeue(5000);
264 277
265 Watchdog.UpdateThread(); 278 Watchdog.UpdateThread();
266 if (req != null) 279 if(req == null)
280 continue;
281
282 try
267 { 283 {
268 try 284 if(!req.HttpContext.CanSend())
269 { 285 {
270 if (req.PollServiceArgs.HasEvents(req.RequestID, req.PollServiceArgs.Id)) 286 req.PollServiceArgs.Drop(req.RequestID, req.PollServiceArgs.Id);
287 byContextDequeue(req);
288 continue;
289 }
290
291 if(req.HttpContext.IsSending())
292 {
293 if ((Environment.TickCount - req.RequestTime) > req.PollServiceArgs.TimeOutms)
271 { 294 {
272 Hashtable responsedata = req.PollServiceArgs.GetEvents(req.RequestID, req.PollServiceArgs.Id); 295 req.PollServiceArgs.Drop(req.RequestID, req.PollServiceArgs.Id);
296 byContextDequeue(req);
297 }
298 else
299 ReQueueEvent(req);
300 continue;
301 }
273 302
303 if (req.PollServiceArgs.HasEvents(req.RequestID, req.PollServiceArgs.Id))
304 {
305 Hashtable responsedata = req.PollServiceArgs.GetEvents(req.RequestID, req.PollServiceArgs.Id);
306
307 m_threadPool.QueueWorkItem(x =>
308 {
309 try
310 {
311 req.DoHTTPGruntWork(m_server, responsedata);
312 byContextDequeue(req);
313 }
314 catch (ObjectDisposedException) // Browser aborted before we could read body, server closed the stream
315 {
316 // Ignore it, no need to reply
317 }
318 return null;
319 }, null);
320 }
321 else
322 {
323 if ((Environment.TickCount - req.RequestTime) > req.PollServiceArgs.TimeOutms)
324 {
274 m_threadPool.QueueWorkItem(x => 325 m_threadPool.QueueWorkItem(x =>
275 { 326 {
276 try 327 try
277 { 328 {
278 req.DoHTTPGruntWork(m_server, responsedata); 329 req.DoHTTPGruntWork(m_server,
330 req.PollServiceArgs.NoEvents(req.RequestID, req.PollServiceArgs.Id));
279 byContextDequeue(req); 331 byContextDequeue(req);
280 } 332 }
281 catch (ObjectDisposedException) // Browser aborted before we could read body, server closed the stream 333 catch (ObjectDisposedException)
282 { 334 {
283 // Ignore it, no need to reply 335 // Ignore it, no need to reply
284 } 336 }
@@ -287,36 +339,15 @@ namespace OpenSim.Framework.Servers.HttpServer
287 } 339 }
288 else 340 else
289 { 341 {
290 if ((Environment.TickCount - req.RequestTime) > req.PollServiceArgs.TimeOutms) 342 ReQueueEvent(req);
291 {
292 m_threadPool.QueueWorkItem(x =>
293 {
294 try
295 {
296 req.DoHTTPGruntWork(m_server,
297 req.PollServiceArgs.NoEvents(req.RequestID, req.PollServiceArgs.Id));
298 byContextDequeue(req);
299 }
300 catch (ObjectDisposedException)
301 {
302 // Ignore it, no need to reply
303 }
304 return null;
305 }, null);
306 }
307 else
308 {
309 ReQueueEvent(req);
310 }
311 } 343 }
312 } 344 }
313 catch (Exception e) 345 }
314 { 346 catch (Exception e)
315 m_log.ErrorFormat("Exception in poll service thread: " + e.ToString()); 347 {
316 } 348 m_log.ErrorFormat("Exception in poll service thread: " + e.ToString());
317 } 349 }
318 } 350 }
319 } 351 }
320
321 } 352 }
322} 353}
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs
index cc614f3..18670f5 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs
@@ -372,7 +372,7 @@ namespace OpenSim.Region.ClientStack.Linden
372 372
373 caps.RegisterPollHandler( 373 caps.RegisterPollHandler(
374 "EventQueueGet", 374 "EventQueueGet",
375 new PollServiceEventArgs(null, GenerateEqgCapPath(eventQueueGetUUID), HasEvents, GetEvents, NoEvents, agentID, SERVER_EQ_TIME_NO_EVENTS)); 375 new PollServiceEventArgs(null, GenerateEqgCapPath(eventQueueGetUUID), HasEvents, GetEvents, NoEvents, Drop, agentID, SERVER_EQ_TIME_NO_EVENTS));
376 } 376 }
377 377
378 public bool HasEvents(UUID requestID, UUID agentID) 378 public bool HasEvents(UUID requestID, UUID agentID)
@@ -403,6 +403,10 @@ namespace OpenSim.Region.ClientStack.Linden
403 ev["message"], m_scene.GetScenePresence(agentId).Name, m_scene.Name); 403 ev["message"], m_scene.GetScenePresence(agentId).Name, m_scene.Name);
404 } 404 }
405 } 405 }
406 public void Drop(UUID requestID, UUID pAgentId)
407 {
408 // do nothing for now, hope client close will do it
409 }
406 410
407 public Hashtable GetEvents(UUID requestID, UUID pAgentId) 411 public Hashtable GetEvents(UUID requestID, UUID pAgentId)
408 { 412 {
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs
index f66ef57..7831de3 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs
@@ -226,7 +226,7 @@ namespace OpenSim.Region.ClientStack.Linden
226 private Scene m_scene; 226 private Scene m_scene;
227 private MeshCapsDataThrottler m_throttler; 227 private MeshCapsDataThrottler m_throttler;
228 public PollServiceMeshEventArgs(string uri, UUID pId, Scene scene) : 228 public PollServiceMeshEventArgs(string uri, UUID pId, Scene scene) :
229 base(null, uri, null, null, null, pId, int.MaxValue) 229 base(null, uri, null, null, null, null, pId, int.MaxValue)
230 { 230 {
231 m_scene = scene; 231 m_scene = scene;
232 m_throttler = new MeshCapsDataThrottler(100000, 1400000, 10000, scene, pId); 232 m_throttler = new MeshCapsDataThrottler(100000, 1400000, 10000, scene, pId);
@@ -241,6 +241,15 @@ namespace OpenSim.Region.ClientStack.Linden
241 241
242 } 242 }
243 }; 243 };
244
245 Drop= (x, y) =>
246 {
247 lock (responses)
248 {
249 responses.Remove(x);
250 }
251 };
252
244 GetEvents = (x, y) => 253 GetEvents = (x, y) =>
245 { 254 {
246 lock (responses) 255 lock (responses)
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs
index 14a59fe..ee7e291 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs
@@ -222,7 +222,7 @@ namespace OpenSim.Region.ClientStack.Linden
222 private Scene m_scene; 222 private Scene m_scene;
223 private CapsDataThrottler m_throttler = new CapsDataThrottler(100000, 1400000,10000); 223 private CapsDataThrottler m_throttler = new CapsDataThrottler(100000, 1400000,10000);
224 public PollServiceTextureEventArgs(UUID pId, Scene scene) : 224 public PollServiceTextureEventArgs(UUID pId, Scene scene) :
225 base(null, "", null, null, null, pId, int.MaxValue) 225 base(null, "", null, null, null, null, pId, int.MaxValue)
226 { 226 {
227 m_scene = scene; 227 m_scene = scene;
228 // x is request id, y is userid 228 // x is request id, y is userid
@@ -236,6 +236,9 @@ namespace OpenSim.Region.ClientStack.Linden
236 236
237 } 237 }
238 }; 238 };
239
240 Drop = (x, y) => { lock (responses) responses.Remove(x); };
241
239 GetEvents = (x, y) => 242 GetEvents = (x, y) =>
240 { 243 {
241 lock (responses) 244 lock (responses)
@@ -423,7 +426,6 @@ namespace OpenSim.Region.ClientStack.Linden
423 426
424 internal sealed class CapsDataThrottler 427 internal sealed class CapsDataThrottler
425 { 428 {
426
427 private volatile int currenttime = 0; 429 private volatile int currenttime = 0;
428 private volatile int lastTimeElapsed = 0; 430 private volatile int lastTimeElapsed = 0;
429 private volatile int BytesSent = 0; 431 private volatile int BytesSent = 0;
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs
index ba4fb76..bde94e6 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs
@@ -256,11 +256,13 @@ namespace OpenSim.Region.ClientStack.Linden
256 private WebFetchInvDescModule m_module; 256 private WebFetchInvDescModule m_module;
257 257
258 public PollServiceInventoryEventArgs(WebFetchInvDescModule module, string url, UUID pId) : 258 public PollServiceInventoryEventArgs(WebFetchInvDescModule module, string url, UUID pId) :
259 base(null, url, null, null, null, pId, int.MaxValue) 259 base(null, url, null, null, null, null, pId, int.MaxValue)
260 { 260 {
261 m_module = module; 261 m_module = module;
262 262
263 HasEvents = (x, y) => { lock (responses) return responses.ContainsKey(x); }; 263 HasEvents = (x, y) => { lock (responses) return responses.ContainsKey(x); };
264 Drop = (x, y) => { lock (responses) responses.Remove(x); };
265
264 GetEvents = (x, y) => 266 GetEvents = (x, y) =>
265 { 267 {
266 lock (responses) 268 lock (responses)
diff --git a/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs b/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs
index f563c68..c118f33 100644
--- a/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs
+++ b/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs
@@ -225,7 +225,7 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
225 string uri = "/lslhttp/" + urlcode.ToString() + "/"; 225 string uri = "/lslhttp/" + urlcode.ToString() + "/";
226 226
227 PollServiceEventArgs args 227 PollServiceEventArgs args
228 = new PollServiceEventArgs(HttpRequestHandler, uri, HasEvents, GetEvents, NoEvents, urlcode, 25000); 228 = new PollServiceEventArgs(HttpRequestHandler, uri, HasEvents, GetEvents, NoEvents, Drop, urlcode, 25000);
229 args.Type = PollServiceEventArgs.EventType.LslHttp; 229 args.Type = PollServiceEventArgs.EventType.LslHttp;
230 m_HttpServer.AddPollServiceHTTPHandler(uri, args); 230 m_HttpServer.AddPollServiceHTTPHandler(uri, args);
231 231
@@ -276,7 +276,7 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
276 string uri = "/lslhttps/" + urlcode.ToString() + "/"; 276 string uri = "/lslhttps/" + urlcode.ToString() + "/";
277 277
278 PollServiceEventArgs args 278 PollServiceEventArgs args
279 = new PollServiceEventArgs(HttpRequestHandler, uri, HasEvents, GetEvents, NoEvents, urlcode, 25000); 279 = new PollServiceEventArgs(HttpRequestHandler, uri, HasEvents, GetEvents, NoEvents, Drop, urlcode, 25000);
280 args.Type = PollServiceEventArgs.EventType.LslHttp; 280 args.Type = PollServiceEventArgs.EventType.LslHttp;
281 m_HttpsServer.AddPollServiceHTTPHandler(uri, args); 281 m_HttpsServer.AddPollServiceHTTPHandler(uri, args);
282 282
@@ -530,6 +530,28 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
530 } 530 }
531 } 531 }
532 } 532 }
533
534 private void Drop(UUID requestID, UUID sessionID)
535 {
536 UrlData url = null;
537 lock (m_RequestMap)
538 {
539 if (m_RequestMap.ContainsKey(requestID))
540 {
541 url = m_RequestMap[requestID];
542 m_RequestMap.Remove(requestID);
543 if(url != null)
544 {
545 lock (url.requests)
546 {
547 if(url.requests.ContainsKey(requestID))
548 url.requests.Remove(requestID);
549 }
550 }
551 }
552 }
553 }
554
533 private Hashtable GetEvents(UUID requestID, UUID sessionID) 555 private Hashtable GetEvents(UUID requestID, UUID sessionID)
534 { 556 {
535 UrlData url = null; 557 UrlData url = null;