aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs37
1 files changed, 26 insertions, 11 deletions
diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs
index 45b1375..c7c7c13 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 BlockingQueue<PollServiceHttpRequest> m_slowRequests = new BlockingQueue<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,20 @@ 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 m_slowRequests.Enqueue(req);
233 else
234 m_requests.Enqueue(req);
235 }
229 } 236 }
230 237
231 private void CheckRetries() 238 private void CheckRetries()
@@ -234,10 +241,18 @@ namespace OpenSim.Framework.Servers.HttpServer
234 { 241 {
235 Thread.Sleep(100); // let the world move .. back to faster rate 242 Thread.Sleep(100); // let the world move .. back to faster rate
236 Watchdog.UpdateThread(); 243 Watchdog.UpdateThread();
237 lock (m_retry_requests) 244 lock (m_retryRequests)
238 { 245 {
239 while (m_retry_requests.Count > 0 && m_running) 246 while (m_retryRequests.Count > 0 && m_running)
240 Enqueue(m_retry_requests.Dequeue()); 247 m_requests.Enqueue(m_retryRequests.Dequeue());
248 }
249 slowCount++;
250 if (slowCount >= 10)
251 {
252 slowCount = 0;
253
254 while (m_slowRequests.Count() > 0 && m_running)
255 m_requests.Enqueue(m_retryRequests.Dequeue());
241 } 256 }
242 } 257 }
243 } 258 }
@@ -261,7 +276,7 @@ namespace OpenSim.Framework.Servers.HttpServer
261 276
262 try 277 try
263 { 278 {
264 foreach (PollServiceHttpRequest req in m_retry_requests) 279 foreach (PollServiceHttpRequest req in m_retryRequests)
265 { 280 {
266 m_server.DoHTTPGruntWork( 281 m_server.DoHTTPGruntWork(
267 req.PollServiceArgs.NoEvents(req.RequestID, req.PollServiceArgs.Id), 282 req.PollServiceArgs.NoEvents(req.RequestID, req.PollServiceArgs.Id),
@@ -273,7 +288,7 @@ namespace OpenSim.Framework.Servers.HttpServer
273 } 288 }
274 289
275 PollServiceHttpRequest wreq; 290 PollServiceHttpRequest wreq;
276 m_retry_requests.Clear(); 291 m_retryRequests.Clear();
277 292
278 while (m_requests.Count() > 0) 293 while (m_requests.Count() > 0)
279 { 294 {
@@ -294,7 +309,7 @@ namespace OpenSim.Framework.Servers.HttpServer
294 309
295 // work threads 310 // work threads
296 311
297 private void poolWorkerJob() 312 private void PoolWorkerJob()
298 { 313 {
299 PollServiceHttpRequest req; 314 PollServiceHttpRequest req;
300 StreamReader str; 315 StreamReader str;