aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs')
-rw-r--r--OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs51
1 files changed, 40 insertions, 11 deletions
diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs
index 45b1375..6f87c85 100644
--- a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs
+++ b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs
@@ -174,13 +174,15 @@ namespace OpenSim.Framework.Servers.HttpServer
174 private readonly BaseHttpServer m_server; 174 private readonly BaseHttpServer m_server;
175 175
176 private BlockingQueue<PollServiceHttpRequest> m_requests = new BlockingQueue<PollServiceHttpRequest>(); 176 private BlockingQueue<PollServiceHttpRequest> m_requests = new BlockingQueue<PollServiceHttpRequest>();
177 private static Queue<PollServiceHttpRequest> m_retry_requests = new Queue<PollServiceHttpRequest>(); 177 private static Queue<PollServiceHttpRequest> m_slowRequests = new Queue<PollServiceHttpRequest>();
178 private static Queue<PollServiceHttpRequest> m_retryRequests = new Queue<PollServiceHttpRequest>();
178 179
179 private uint m_WorkerThreadCount = 0; 180 private uint m_WorkerThreadCount = 0;
180 private Thread[] m_workerThreads; 181 private Thread[] m_workerThreads;
181 private Thread m_retrysThread; 182 private Thread m_retrysThread;
182 183
183 private bool m_running = true; 184 private bool m_running = true;
185 private int slowCount = 0;
184 186
185// private int m_timeout = 1000; // increase timeout 250; now use the event one 187// private int m_timeout = 1000; // increase timeout 250; now use the event one
186 188
@@ -195,7 +197,7 @@ namespace OpenSim.Framework.Servers.HttpServer
195 { 197 {
196 m_workerThreads[i] 198 m_workerThreads[i]
197 = Watchdog.StartThread( 199 = Watchdog.StartThread(
198 poolWorkerJob, 200 PoolWorkerJob,
199 String.Format("PollServiceWorkerThread{0}", i), 201 String.Format("PollServiceWorkerThread{0}", i),
200 ThreadPriority.Normal, 202 ThreadPriority.Normal,
201 false, 203 false,
@@ -217,15 +219,25 @@ namespace OpenSim.Framework.Servers.HttpServer
217 { 219 {
218 if (m_running) 220 if (m_running)
219 { 221 {
220 lock (m_retry_requests) 222 lock (m_retryRequests)
221 m_retry_requests.Enqueue(req); 223 m_retryRequests.Enqueue(req);
222 } 224 }
223 } 225 }
224 226
225 public void Enqueue(PollServiceHttpRequest req) 227 public void Enqueue(PollServiceHttpRequest req)
226 { 228 {
227 if (m_running) 229 if (m_running)
228 m_requests.Enqueue(req); 230 {
231 if (req.PollServiceArgs.Type == PollServiceEventArgs.EventType.LslHttp)
232 {
233 m_requests.Enqueue(req);
234 }
235 else
236 {
237 lock (m_slowRequests)
238 m_slowRequests.Enqueue(req);
239 }
240 }
229 } 241 }
230 242
231 private void CheckRetries() 243 private void CheckRetries()
@@ -234,10 +246,21 @@ namespace OpenSim.Framework.Servers.HttpServer
234 { 246 {
235 Thread.Sleep(100); // let the world move .. back to faster rate 247 Thread.Sleep(100); // let the world move .. back to faster rate
236 Watchdog.UpdateThread(); 248 Watchdog.UpdateThread();
237 lock (m_retry_requests) 249 lock (m_retryRequests)
238 { 250 {
239 while (m_retry_requests.Count > 0 && m_running) 251 while (m_retryRequests.Count > 0 && m_running)
240 Enqueue(m_retry_requests.Dequeue()); 252 m_requests.Enqueue(m_retryRequests.Dequeue());
253 }
254 slowCount++;
255 if (slowCount >= 10)
256 {
257 slowCount = 0;
258
259 lock (m_slowRequests)
260 {
261 while (m_slowRequests.Count > 0 && m_running)
262 m_requests.Enqueue(m_slowRequests.Dequeue());
263 }
241 } 264 }
242 } 265 }
243 } 266 }
@@ -261,7 +284,7 @@ namespace OpenSim.Framework.Servers.HttpServer
261 284
262 try 285 try
263 { 286 {
264 foreach (PollServiceHttpRequest req in m_retry_requests) 287 foreach (PollServiceHttpRequest req in m_retryRequests)
265 { 288 {
266 m_server.DoHTTPGruntWork( 289 m_server.DoHTTPGruntWork(
267 req.PollServiceArgs.NoEvents(req.RequestID, req.PollServiceArgs.Id), 290 req.PollServiceArgs.NoEvents(req.RequestID, req.PollServiceArgs.Id),
@@ -273,7 +296,13 @@ namespace OpenSim.Framework.Servers.HttpServer
273 } 296 }
274 297
275 PollServiceHttpRequest wreq; 298 PollServiceHttpRequest wreq;
276 m_retry_requests.Clear(); 299 m_retryRequests.Clear();
300
301 lock (m_slowRequests)
302 {
303 while (m_slowRequests.Count > 0 && m_running)
304 m_requests.Enqueue(m_slowRequests.Dequeue());
305 }
277 306
278 while (m_requests.Count() > 0) 307 while (m_requests.Count() > 0)
279 { 308 {
@@ -294,7 +323,7 @@ namespace OpenSim.Framework.Servers.HttpServer
294 323
295 // work threads 324 // work threads
296 325
297 private void poolWorkerJob() 326 private void PoolWorkerJob()
298 { 327 {
299 PollServiceHttpRequest req; 328 PollServiceHttpRequest req;
300 StreamReader str; 329 StreamReader str;