From b8c2efa49c35d623a6a2969322536fde67cb86dc Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 6 Jul 2012 00:23:05 +0200 Subject: Convert the slow request queue into a regular queue and add some cleanup and locking. --- .../HttpServer/PollServiceRequestManager.cs | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'OpenSim/Framework/Servers') diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs index 06745f9..6f87c85 100644 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs +++ b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs @@ -174,7 +174,7 @@ namespace OpenSim.Framework.Servers.HttpServer private readonly BaseHttpServer m_server; private BlockingQueue m_requests = new BlockingQueue(); - private BlockingQueue m_slowRequests = new BlockingQueue(); + private static Queue m_slowRequests = new Queue(); private static Queue m_retryRequests = new Queue(); private uint m_WorkerThreadCount = 0; @@ -229,9 +229,14 @@ namespace OpenSim.Framework.Servers.HttpServer if (m_running) { if (req.PollServiceArgs.Type == PollServiceEventArgs.EventType.LslHttp) + { m_requests.Enqueue(req); + } else - m_slowRequests.Enqueue(req); + { + lock (m_slowRequests) + m_slowRequests.Enqueue(req); + } } } @@ -251,8 +256,11 @@ namespace OpenSim.Framework.Servers.HttpServer { slowCount = 0; - while (m_slowRequests.Count() > 0 && m_running) - m_requests.Enqueue(m_slowRequests.Dequeue()); + lock (m_slowRequests) + { + while (m_slowRequests.Count > 0 && m_running) + m_requests.Enqueue(m_slowRequests.Dequeue()); + } } } } @@ -290,6 +298,12 @@ namespace OpenSim.Framework.Servers.HttpServer PollServiceHttpRequest wreq; m_retryRequests.Clear(); + lock (m_slowRequests) + { + while (m_slowRequests.Count > 0 && m_running) + m_requests.Enqueue(m_slowRequests.Dequeue()); + } + while (m_requests.Count() > 0) { try -- cgit v1.1