diff options
Diffstat (limited to 'OpenSim/Framework/Servers')
3 files changed, 38 insertions, 38 deletions
diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index 29593e5..1d35b1a 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs | |||
@@ -334,6 +334,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
334 | StreamReader reader = new StreamReader(requestStream, encoding); | 334 | StreamReader reader = new StreamReader(requestStream, encoding); |
335 | 335 | ||
336 | string requestBody = reader.ReadToEnd(); | 336 | string requestBody = reader.ReadToEnd(); |
337 | reader.Close(); | ||
337 | 338 | ||
338 | Hashtable keysvals = new Hashtable(); | 339 | Hashtable keysvals = new Hashtable(); |
339 | Hashtable headervals = new Hashtable(); | 340 | Hashtable headervals = new Hashtable(); |
@@ -648,7 +649,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
648 | // Every month or so this will wrap and give bad numbers, not really a problem | 649 | // Every month or so this will wrap and give bad numbers, not really a problem |
649 | // since its just for reporting | 650 | // since its just for reporting |
650 | int tickdiff = requestEndTick - requestStartTick; | 651 | int tickdiff = requestEndTick - requestStartTick; |
651 | if (tickdiff > 3000 && requestHandler.Name != "GetTexture") | 652 | if (tickdiff > 3000 && (requestHandler == null || requestHandler.Name == null || requestHandler.Name != "GetTexture")) |
652 | { | 653 | { |
653 | m_log.InfoFormat( | 654 | m_log.InfoFormat( |
654 | "[BASE HTTP SERVER]: Slow handling of {0} {1} {2} {3} {4} from {5} took {6}ms", | 655 | "[BASE HTTP SERVER]: Slow handling of {0} {1} {2} {3} {4} from {5} took {6}ms", |
@@ -1555,6 +1556,8 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
1555 | else | 1556 | else |
1556 | responseString = (string)responsedata["str_response_string"]; | 1557 | responseString = (string)responsedata["str_response_string"]; |
1557 | contentType = (string)responsedata["content_type"]; | 1558 | contentType = (string)responsedata["content_type"]; |
1559 | if (responseString == null) | ||
1560 | responseString = String.Empty; | ||
1558 | } | 1561 | } |
1559 | catch | 1562 | catch |
1560 | { | 1563 | { |
diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceEventArgs.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceEventArgs.cs index a80b1d7..d0a37d0 100644 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceEventArgs.cs +++ b/OpenSim/Framework/Servers/HttpServer/PollServiceEventArgs.cs | |||
@@ -34,7 +34,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
34 | public delegate void RequestMethod(UUID requestID, Hashtable request); | 34 | public delegate void RequestMethod(UUID requestID, Hashtable request); |
35 | public delegate bool HasEventsMethod(UUID requestID, UUID pId); | 35 | public delegate bool HasEventsMethod(UUID requestID, UUID pId); |
36 | 36 | ||
37 | public delegate Hashtable GetEventsMethod(UUID requestID, UUID pId, string request); | 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 | 40 | ||
@@ -46,7 +46,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
46 | public RequestMethod Request; | 46 | public RequestMethod Request; |
47 | public UUID Id; | 47 | public UUID Id; |
48 | public int TimeOutms; | 48 | public int TimeOutms; |
49 | public EventType Type; | 49 | public EventType Type; |
50 | 50 | ||
51 | public enum EventType : int | 51 | public enum EventType : int |
52 | { | 52 | { |
diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs index db088e7..4be8bf4 100644 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs +++ b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs | |||
@@ -33,6 +33,7 @@ using log4net; | |||
33 | using HttpServer; | 33 | using HttpServer; |
34 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
35 | using OpenSim.Framework.Monitoring; | 35 | using OpenSim.Framework.Monitoring; |
36 | using Amib.Threading; | ||
36 | 37 | ||
37 | 38 | ||
38 | /* | 39 | /* |
@@ -185,6 +186,8 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
185 | private bool m_running = true; | 186 | private bool m_running = true; |
186 | private int slowCount = 0; | 187 | private int slowCount = 0; |
187 | 188 | ||
189 | private SmartThreadPool m_threadPool = new SmartThreadPool(20000, 12, 2); | ||
190 | |||
188 | // private int m_timeout = 1000; // increase timeout 250; now use the event one | 191 | // private int m_timeout = 1000; // increase timeout 250; now use the event one |
189 | 192 | ||
190 | public PollServiceRequestManager(BaseHttpServer pSrv, uint pWorkerThreadCount, int pTimeout) | 193 | public PollServiceRequestManager(BaseHttpServer pSrv, uint pWorkerThreadCount, int pTimeout) |
@@ -202,7 +205,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
202 | String.Format("PollServiceWorkerThread{0}", i), | 205 | String.Format("PollServiceWorkerThread{0}", i), |
203 | ThreadPriority.Normal, | 206 | ThreadPriority.Normal, |
204 | false, | 207 | false, |
205 | true, | 208 | false, |
206 | null, | 209 | null, |
207 | int.MaxValue); | 210 | int.MaxValue); |
208 | } | 211 | } |
@@ -275,15 +278,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
275 | Thread.Sleep(1000); // let the world move | 278 | Thread.Sleep(1000); // let the world move |
276 | 279 | ||
277 | foreach (Thread t in m_workerThreads) | 280 | foreach (Thread t in m_workerThreads) |
278 | { | 281 | Watchdog.AbortThread(t.ManagedThreadId); |
279 | try | ||
280 | { | ||
281 | t.Abort(); | ||
282 | } | ||
283 | catch | ||
284 | { | ||
285 | } | ||
286 | } | ||
287 | 282 | ||
288 | try | 283 | try |
289 | { | 284 | { |
@@ -326,13 +321,9 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
326 | 321 | ||
327 | private void PoolWorkerJob() | 322 | private void PoolWorkerJob() |
328 | { | 323 | { |
329 | PollServiceHttpRequest req; | ||
330 | StreamReader str; | ||
331 | |||
332 | // while (true) | ||
333 | while (m_running) | 324 | while (m_running) |
334 | { | 325 | { |
335 | req = m_requests.Dequeue(5000); | 326 | PollServiceHttpRequest req = m_requests.Dequeue(5000); |
336 | 327 | ||
337 | Watchdog.UpdateThread(); | 328 | Watchdog.UpdateThread(); |
338 | if (req != null) | 329 | if (req != null) |
@@ -341,35 +332,41 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
341 | { | 332 | { |
342 | if (req.PollServiceArgs.HasEvents(req.RequestID, req.PollServiceArgs.Id)) | 333 | if (req.PollServiceArgs.HasEvents(req.RequestID, req.PollServiceArgs.Id)) |
343 | { | 334 | { |
344 | try | 335 | Hashtable responsedata = req.PollServiceArgs.GetEvents(req.RequestID, req.PollServiceArgs.Id); |
345 | { | 336 | |
346 | str = new StreamReader(req.Request.Body); | 337 | if (responsedata == null) |
347 | } | ||
348 | catch (System.ArgumentException) | ||
349 | { | ||
350 | // Stream was not readable means a child agent | ||
351 | // was closed due to logout, leaving the | ||
352 | // Event Queue request orphaned. | ||
353 | continue; | 338 | continue; |
354 | } | ||
355 | 339 | ||
356 | try | 340 | if (req.PollServiceArgs.Type == PollServiceEventArgs.EventType.Normal) |
357 | { | 341 | { |
358 | Hashtable responsedata = req.PollServiceArgs.GetEvents(req.RequestID, req.PollServiceArgs.Id, str.ReadToEnd()); | 342 | try |
359 | DoHTTPGruntWork(m_server, req, responsedata); | 343 | { |
344 | DoHTTPGruntWork(m_server, req, responsedata); | ||
345 | } | ||
346 | catch (ObjectDisposedException) // Browser aborted before we could read body, server closed the stream | ||
347 | { | ||
348 | // Ignore it, no need to reply | ||
349 | } | ||
360 | } | 350 | } |
361 | catch (ObjectDisposedException) // Browser aborted before we could read body, server closed the stream | 351 | else |
362 | { | 352 | { |
363 | // Ignore it, no need to reply | 353 | m_threadPool.QueueWorkItem(x => |
354 | { | ||
355 | try | ||
356 | { | ||
357 | DoHTTPGruntWork(m_server, req, responsedata); | ||
358 | } | ||
359 | catch (ObjectDisposedException) // Browser aborted before we could read body, server closed the stream | ||
360 | { | ||
361 | // Ignore it, no need to reply | ||
362 | } | ||
363 | |||
364 | return null; | ||
365 | }, null); | ||
364 | } | 366 | } |
365 | |||
366 | str.Close(); | ||
367 | |||
368 | } | 367 | } |
369 | else | 368 | else |
370 | { | 369 | { |
371 | // if ((Environment.TickCount - req.RequestTime) > m_timeout) | ||
372 | |||
373 | if ((Environment.TickCount - req.RequestTime) > req.PollServiceArgs.TimeOutms) | 370 | if ((Environment.TickCount - req.RequestTime) > req.PollServiceArgs.TimeOutms) |
374 | { | 371 | { |
375 | DoHTTPGruntWork(m_server, req, | 372 | DoHTTPGruntWork(m_server, req, |