aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Servers
diff options
context:
space:
mode:
authorMelanie2012-09-23 23:16:25 +0200
committerMelanie2012-09-23 23:16:25 +0200
commit2d02405186841d5aeea30b608d106212f5fee1c3 (patch)
tree54691715937f806e4bf5af4d3db77e89167ceedd /OpenSim/Framework/Servers
parenttry to allow free uploads for testing, if users prefix names with "TEST-". Let (diff)
downloadopensim-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/Servers')
-rw-r--r--OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs45
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;
33using HttpServer; 33using HttpServer;
34using OpenSim.Framework; 34using OpenSim.Framework;
35using OpenSim.Framework.Monitoring; 35using OpenSim.Framework.Monitoring;
36using 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 {