aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs
diff options
context:
space:
mode:
authorMelanie2012-09-27 17:29:44 +0100
committerMelanie2012-09-27 17:29:44 +0100
commit001ec0e2e6f8c426af8f4a1c1eb9be4db066aea4 (patch)
tree11170fddbd0f4c71c6f8288b5848442dfdc90d76 /OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs
parentRemove a core undo call that we don't need. (diff)
parentMerge branch 'ubitwork' into avination (diff)
downloadopensim-SC_OLD-001ec0e2e6f8c426af8f4a1c1eb9be4db066aea4.zip
opensim-SC_OLD-001ec0e2e6f8c426af8f4a1c1eb9be4db066aea4.tar.gz
opensim-SC_OLD-001ec0e2e6f8c426af8f4a1c1eb9be4db066aea4.tar.bz2
opensim-SC_OLD-001ec0e2e6f8c426af8f4a1c1eb9be4db066aea4.tar.xz
Merge branch 'avination' into careminster
Conflicts: OpenSim/Region/CoreModules/Agent/AssetTransaction/AgentAssetsTransactions.cs OpenSim/Region/Framework/Scenes/Scene.cs
Diffstat (limited to 'OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs')
-rw-r--r--OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs67
1 files changed, 32 insertions, 35 deletions
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;
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)
@@ -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,