diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs index bbfab646b5..3f431495bf 100644 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs +++ b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs @@ -44,7 +44,7 @@ namespace OpenSim.Framework.Servers.HttpServer private readonly BaseHttpServer m_server; private Dictionary> m_bycontext; - private BlockingQueue m_requests = new BlockingQueue(); + private BlockingCollection m_requests = new BlockingCollection(); private static ConcurrentQueue m_retryRequests = new ConcurrentQueue(); private uint m_WorkerThreadCount = 0; @@ -166,7 +166,7 @@ namespace OpenSim.Framework.Servers.HttpServer public void EnqueueInt(PollServiceHttpRequest req) { if (m_running) - m_requests.Enqueue(req); + m_requests.Add(req); } private void CheckRetries() @@ -177,7 +177,7 @@ namespace OpenSim.Framework.Servers.HttpServer Thread.Sleep(100); Watchdog.UpdateThread(); while (m_running && m_retryRequests.TryDequeue(out preq)) - m_requests.Enqueue(preq); + m_requests.Add(preq); } } @@ -198,9 +198,9 @@ namespace OpenSim.Framework.Servers.HttpServer qu.Clear(); m_bycontext.Clear(); + PollServiceHttpRequest req; try { - PollServiceHttpRequest req; while(m_retryRequests.TryDequeue(out req)) req.DoHTTPstop(m_server); } @@ -208,21 +208,17 @@ namespace OpenSim.Framework.Servers.HttpServer { } - PollServiceHttpRequest wreq; - - while (m_requests.Count() > 0) + try + { + while(m_requests.TryTake(out req, 0)) + req.DoHTTPstop(m_server); + } + catch { - try - { - wreq = m_requests.Dequeue(0); - wreq.DoHTTPstop(m_server); - } - catch - { - } } - m_requests.Clear(); + m_requests.Dispose(); + } // work threads @@ -231,7 +227,8 @@ namespace OpenSim.Framework.Servers.HttpServer { while (m_running) { - PollServiceHttpRequest req = m_requests.Dequeue(4500); + PollServiceHttpRequest req; + m_requests.TryTake(out req, 4500); Watchdog.UpdateThread(); if(req == null) continue;