Add an event to the poll service manager thread to allow starting it

when needed rather than once per second. That is just too slow!
avinationmerge
Melanie 2012-06-26 10:49:37 +02:00
parent 2548d15878
commit 9a8de52940
2 changed files with 14 additions and 4 deletions

View File

@ -41,6 +41,7 @@ namespace OpenSim.Framework.Servers.HttpServer
private readonly BaseHttpServer m_server;
private static Queue m_requests = Queue.Synchronized(new Queue());
private static ManualResetEvent m_ev = new ManualResetEvent(false);
private uint m_WorkerThreadCount = 0;
private Thread[] m_workerThreads;
private PollServiceWorkerThread[] m_PollServiceWorkerThreads;
@ -88,15 +89,17 @@ namespace OpenSim.Framework.Servers.HttpServer
{
lock (m_requests)
m_requests.Enqueue(req);
m_ev.Set();
}
public void ThreadStart()
{
while (m_running)
{
m_ev.WaitOne(1000);
m_ev.Reset();
Watchdog.UpdateThread();
ProcessQueuedRequests();
Thread.Sleep(1000);
}
}

View File

@ -89,10 +89,17 @@ namespace OpenSim.Framework.Servers.HttpServer
continue;
}
try
{
Hashtable responsedata = req.PollServiceArgs.GetEvents(req.RequestID, req.PollServiceArgs.Id, str.ReadToEnd());
m_server.DoHTTPGruntWork(responsedata,
new OSHttpResponse(new HttpResponse(req.HttpContext, req.Request),req.HttpContext));
}
catch (ObjectDisposedException) // Browser aborted before we could read body, server closed the stream
{
// Ignore it, no need to reply
}
}
else
{
if ((Environment.TickCount - req.RequestTime) > m_timeout)