diff options
author | Melanie | 2012-09-23 23:16:25 +0200 |
---|---|---|
committer | Melanie | 2012-09-23 23:16:25 +0200 |
commit | 2d02405186841d5aeea30b608d106212f5fee1c3 (patch) | |
tree | 54691715937f806e4bf5af4d3db77e89167ceedd /OpenSim/Framework | |
parent | try to allow free uploads for testing, if users prefix names with "TEST-". Let (diff) | |
download | opensim-SC-2d02405186841d5aeea30b608d106212f5fee1c3.zip opensim-SC-2d02405186841d5aeea30b608d106212f5fee1c3.tar.gz opensim-SC-2d02405186841d5aeea30b608d106212f5fee1c3.tar.bz2 opensim-SC-2d02405186841d5aeea30b608d106212f5fee1c3.tar.xz |
Change the poll service to use a thread pool for replies to make sure the
event queues aren't blocked by other traffic.
Diffstat (limited to 'OpenSim/Framework')
-rw-r--r-- | OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs | 45 |
1 files changed, 38 insertions, 7 deletions
diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs index db088e7..c13c65b 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) |
@@ -353,18 +356,46 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
353 | continue; | 356 | continue; |
354 | } | 357 | } |
355 | 358 | ||
356 | try | 359 | // "Normal" means the viewer evebt queue. We need to push these out fast. |
360 | // Process them inline. The rest go to the thread pool. | ||
361 | if (req.PollServiceArgs.Type == PollServiceEventArgs.EventType.Normal) | ||
357 | { | 362 | { |
358 | Hashtable responsedata = req.PollServiceArgs.GetEvents(req.RequestID, req.PollServiceArgs.Id, str.ReadToEnd()); | 363 | try |
359 | DoHTTPGruntWork(m_server, req, responsedata); | 364 | { |
365 | Hashtable responsedata = req.PollServiceArgs.GetEvents(req.RequestID, req.PollServiceArgs.Id, str.ReadToEnd()); | ||
366 | DoHTTPGruntWork(m_server, req, responsedata); | ||
367 | } | ||
368 | catch (ObjectDisposedException) // Browser aborted before we could read body, server closed the stream | ||
369 | { | ||
370 | // Ignore it, no need to reply | ||
371 | } | ||
372 | finally | ||
373 | { | ||
374 | str.Close(); | ||
375 | } | ||
360 | } | 376 | } |
361 | catch (ObjectDisposedException) // Browser aborted before we could read body, server closed the stream | 377 | else |
362 | { | 378 | { |
363 | // Ignore it, no need to reply | 379 | m_threadPool.QueueWorkItem(x => |
380 | { | ||
381 | try | ||
382 | { | ||
383 | Hashtable responsedata = req.PollServiceArgs.GetEvents(req.RequestID, req.PollServiceArgs.Id, str.ReadToEnd()); | ||
384 | DoHTTPGruntWork(m_server, req, responsedata); | ||
385 | } | ||
386 | catch (ObjectDisposedException) // Browser aborted before we could read body, server closed the stream | ||
387 | { | ||
388 | // Ignore it, no need to reply | ||
389 | } | ||
390 | finally | ||
391 | { | ||
392 | str.Close(); | ||
393 | } | ||
394 | |||
395 | return null; | ||
396 | }, null); | ||
364 | } | 397 | } |
365 | 398 | ||
366 | str.Close(); | ||
367 | |||
368 | } | 399 | } |
369 | else | 400 | else |
370 | { | 401 | { |