diff options
author | Melanie | 2012-06-26 10:49:37 +0200 |
---|---|---|
committer | Melanie | 2012-06-26 10:49:37 +0200 |
commit | 9a8de52940ea6d9ce430d8d51094a353eca7d3c5 (patch) | |
tree | 900381245784707596ce8c03214a8025e5109e2f | |
parent | Disable physics raycast until it can be seen to. Fix distance calculation (diff) | |
download | opensim-SC_OLD-9a8de52940ea6d9ce430d8d51094a353eca7d3c5.zip opensim-SC_OLD-9a8de52940ea6d9ce430d8d51094a353eca7d3c5.tar.gz opensim-SC_OLD-9a8de52940ea6d9ce430d8d51094a353eca7d3c5.tar.bz2 opensim-SC_OLD-9a8de52940ea6d9ce430d8d51094a353eca7d3c5.tar.xz |
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!
-rw-r--r-- | OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs | 7 | ||||
-rw-r--r-- | OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs | 11 |
2 files changed, 14 insertions, 4 deletions
diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs index 0062d4e..c3e1a79 100644 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs +++ b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs | |||
@@ -41,6 +41,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
41 | 41 | ||
42 | private readonly BaseHttpServer m_server; | 42 | private readonly BaseHttpServer m_server; |
43 | private static Queue m_requests = Queue.Synchronized(new Queue()); | 43 | private static Queue m_requests = Queue.Synchronized(new Queue()); |
44 | private static ManualResetEvent m_ev = new ManualResetEvent(false); | ||
44 | private uint m_WorkerThreadCount = 0; | 45 | private uint m_WorkerThreadCount = 0; |
45 | private Thread[] m_workerThreads; | 46 | private Thread[] m_workerThreads; |
46 | private PollServiceWorkerThread[] m_PollServiceWorkerThreads; | 47 | private PollServiceWorkerThread[] m_PollServiceWorkerThreads; |
@@ -88,15 +89,17 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
88 | { | 89 | { |
89 | lock (m_requests) | 90 | lock (m_requests) |
90 | m_requests.Enqueue(req); | 91 | m_requests.Enqueue(req); |
92 | m_ev.Set(); | ||
91 | } | 93 | } |
92 | 94 | ||
93 | public void ThreadStart() | 95 | public void ThreadStart() |
94 | { | 96 | { |
95 | while (m_running) | 97 | while (m_running) |
96 | { | 98 | { |
99 | m_ev.WaitOne(1000); | ||
100 | m_ev.Reset(); | ||
97 | Watchdog.UpdateThread(); | 101 | Watchdog.UpdateThread(); |
98 | ProcessQueuedRequests(); | 102 | ProcessQueuedRequests(); |
99 | Thread.Sleep(1000); | ||
100 | } | 103 | } |
101 | } | 104 | } |
102 | 105 | ||
@@ -152,4 +155,4 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
152 | m_running = false; | 155 | m_running = false; |
153 | } | 156 | } |
154 | } | 157 | } |
155 | } \ No newline at end of file | 158 | } |
diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs index 5e171f0..b39185f 100644 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs +++ b/OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs | |||
@@ -89,9 +89,16 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
89 | continue; | 89 | continue; |
90 | } | 90 | } |
91 | 91 | ||
92 | Hashtable responsedata = req.PollServiceArgs.GetEvents(req.RequestID, req.PollServiceArgs.Id, str.ReadToEnd()); | 92 | try |
93 | m_server.DoHTTPGruntWork(responsedata, | 93 | { |
94 | Hashtable responsedata = req.PollServiceArgs.GetEvents(req.RequestID, req.PollServiceArgs.Id, str.ReadToEnd()); | ||
95 | m_server.DoHTTPGruntWork(responsedata, | ||
94 | new OSHttpResponse(new HttpResponse(req.HttpContext, req.Request),req.HttpContext)); | 96 | new OSHttpResponse(new HttpResponse(req.HttpContext, req.Request),req.HttpContext)); |
97 | } | ||
98 | catch (ObjectDisposedException) // Browser aborted before we could read body, server closed the stream | ||
99 | { | ||
100 | // Ignore it, no need to reply | ||
101 | } | ||
95 | } | 102 | } |
96 | else | 103 | else |
97 | { | 104 | { |