aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Servers
diff options
context:
space:
mode:
authorUbitUmarov2015-09-02 19:54:53 +0100
committerUbitUmarov2015-09-02 19:54:53 +0100
commita11edceb00b5b86f825bd957bdac9edb91f893dd (patch)
treec192eae26f3aadf365a66f32fc6d9ade2f0a0c61 /OpenSim/Framework/Servers
parentbad merge? (diff)
downloadopensim-SC_OLD-a11edceb00b5b86f825bd957bdac9edb91f893dd.zip
opensim-SC_OLD-a11edceb00b5b86f825bd957bdac9edb91f893dd.tar.gz
opensim-SC_OLD-a11edceb00b5b86f825bd957bdac9edb91f893dd.tar.bz2
opensim-SC_OLD-a11edceb00b5b86f825bd957bdac9edb91f893dd.tar.xz
seems to compile ( tests comented out)
Diffstat (limited to 'OpenSim/Framework/Servers')
-rw-r--r--OpenSim/Framework/Servers/BaseOpenSimServer.cs12
-rw-r--r--OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs6
-rw-r--r--OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs182
-rw-r--r--OpenSim/Framework/Servers/Tests/OSHttpTests.cs6
4 files changed, 31 insertions, 175 deletions
diff --git a/OpenSim/Framework/Servers/BaseOpenSimServer.cs b/OpenSim/Framework/Servers/BaseOpenSimServer.cs
index 60702d4..09b0801 100644
--- a/OpenSim/Framework/Servers/BaseOpenSimServer.cs
+++ b/OpenSim/Framework/Servers/BaseOpenSimServer.cs
@@ -65,12 +65,9 @@ namespace OpenSim.Framework.Servers
65 /// This will control a periodic log printout of the current 'show stats' (if they are active) for this 65 /// This will control a periodic log printout of the current 'show stats' (if they are active) for this
66 /// server. 66 /// server.
67 /// </summary> 67 /// </summary>
68<<<<<<< HEAD 68
69 private int m_periodDiagnosticTimerMS = 60 * 60 * 1000; 69 private int m_periodDiagnosticTimerMS = 60 * 60 * 1000;
70 private Timer m_periodicDiagnosticsTimer = new Timer(60 * 60 * 1000); 70 private Timer m_periodicDiagnosticsTimer = new Timer(60 * 60 * 1000);
71=======
72// private Timer m_periodicDiagnosticsTimer = new Timer(60 * 60 * 1000);
73>>>>>>> avn/ubitvar
74 71
75 /// <summary> 72 /// <summary>
76 /// Random uuid for private data 73 /// Random uuid for private data
@@ -88,11 +85,8 @@ namespace OpenSim.Framework.Servers
88 // Random uuid for private data 85 // Random uuid for private data
89 m_osSecret = UUID.Random().ToString(); 86 m_osSecret = UUID.Random().ToString();
90 87
91<<<<<<< HEAD 88 m_periodicDiagnosticsTimer.Elapsed += new ElapsedEventHandler(LogDiagnostics);
92======= 89 m_periodicDiagnosticsTimer.Enabled = true;
93// m_periodicDiagnosticsTimer.Elapsed += new ElapsedEventHandler(LogDiagnostics);
94// m_periodicDiagnosticsTimer.Enabled = true;
95>>>>>>> avn/ubitvar
96 } 90 }
97 91
98 /// <summary> 92 /// <summary>
diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
index 616c673..85976ab 100644
--- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
+++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
@@ -1947,14 +1947,10 @@ namespace OpenSim.Framework.Servers.HttpServer
1947 m_httpListener2.Start(64); 1947 m_httpListener2.Start(64);
1948 1948
1949 // Long Poll Service Manager with 3 worker threads a 25 second timeout for no events 1949 // Long Poll Service Manager with 3 worker threads a 25 second timeout for no events
1950<<<<<<< HEAD 1950
1951 PollServiceRequestManager = new PollServiceRequestManager(this, performPollResponsesAsync, 3, 25000); 1951 PollServiceRequestManager = new PollServiceRequestManager(this, performPollResponsesAsync, 3, 25000);
1952 PollServiceRequestManager.Start(); 1952 PollServiceRequestManager.Start();
1953 1953
1954=======
1955 m_PollServiceManager = new PollServiceRequestManager(this, 4, 25000);
1956 m_PollServiceManager.Start();
1957>>>>>>> avn/ubitvar
1958 HTTPDRunning = true; 1954 HTTPDRunning = true;
1959 1955
1960 //HttpListenerContext context; 1956 //HttpListenerContext context;
diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs
index 4ffe6e5..571e8d8 100644
--- a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs
+++ b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs
@@ -74,16 +74,11 @@ namespace OpenSim.Framework.Servers.HttpServer
74 private Thread[] m_workerThreads; 74 private Thread[] m_workerThreads;
75 private Thread m_retrysThread; 75 private Thread m_retrysThread;
76 76
77<<<<<<< HEAD
78 private SmartThreadPool m_threadPool = new SmartThreadPool(20000, 12, 2);
79
80// private int m_timeout = 1000; // increase timeout 250; now use the event one
81=======
82 private bool m_running = true; 77 private bool m_running = true;
83 private int slowCount = 0; 78 private int slowCount = 0;
84 79
85 private SmartThreadPool m_threadPool; 80 private SmartThreadPool m_threadPool;
86>>>>>>> avn/ubitvar 81
87 82
88 public PollServiceRequestManager( 83 public PollServiceRequestManager(
89 BaseHttpServer pSrv, bool performResponsesAsync, uint pWorkerThreadCount, int pTimeout) 84 BaseHttpServer pSrv, bool performResponsesAsync, uint pWorkerThreadCount, int pTimeout)
@@ -93,7 +88,7 @@ namespace OpenSim.Framework.Servers.HttpServer
93 m_WorkerThreadCount = pWorkerThreadCount; 88 m_WorkerThreadCount = pWorkerThreadCount;
94 m_workerThreads = new Thread[m_WorkerThreadCount]; 89 m_workerThreads = new Thread[m_WorkerThreadCount];
95 90
96<<<<<<< HEAD 91/*
97 StatsManager.RegisterStat( 92 StatsManager.RegisterStat(
98 new Stat( 93 new Stat(
99 "QueuedPollResponses", 94 "QueuedPollResponses",
@@ -119,7 +114,7 @@ namespace OpenSim.Framework.Servers.HttpServer
119 MeasuresOfInterest.AverageChangeOverTime, 114 MeasuresOfInterest.AverageChangeOverTime,
120 stat => stat.Value = ResponsesProcessed, 115 stat => stat.Value = ResponsesProcessed,
121 StatVerbosity.Debug)); 116 StatVerbosity.Debug));
122======= 117*/
123 PollServiceHttpRequestComparer preqCp = new PollServiceHttpRequestComparer(); 118 PollServiceHttpRequestComparer preqCp = new PollServiceHttpRequestComparer();
124 m_bycontext = new Dictionary<PollServiceHttpRequest, Queue<PollServiceHttpRequest>>(preqCp); 119 m_bycontext = new Dictionary<PollServiceHttpRequest, Queue<PollServiceHttpRequest>>(preqCp);
125 120
@@ -132,46 +127,16 @@ namespace OpenSim.Framework.Servers.HttpServer
132 startInfo.ThreadPoolName = "PoolService"; 127 startInfo.ThreadPoolName = "PoolService";
133 128
134 m_threadPool = new SmartThreadPool(startInfo); 129 m_threadPool = new SmartThreadPool(startInfo);
135>>>>>>> avn/ubitvar
136 } 130 }
137 131
138 public void Start() 132 public void Start()
139 { 133 {
140<<<<<<< HEAD
141 IsRunning = true;
142
143 if (PerformResponsesAsync)
144 {
145 //startup worker threads
146 for (uint i = 0; i < m_WorkerThreadCount; i++)
147 {
148 m_workerThreads[i]
149 = WorkManager.StartThread(
150 PoolWorkerJob,
151 string.Format("PollServiceWorkerThread{0}:{1}", i, m_server.Port),
152 ThreadPriority.Normal,
153 false,
154 false,
155 null,
156 int.MaxValue);
157 }
158
159 WorkManager.StartThread(
160 this.CheckLongPollThreads,
161 string.Format("LongPollServiceWatcherThread:{0}", m_server.Port),
162 ThreadPriority.Normal,
163 false,
164 true,
165 null,
166 1000 * 60 * 10);
167 }
168=======
169 m_threadPool.Start(); 134 m_threadPool.Start();
170 //startup worker threads 135 //startup worker threads
171 for (uint i = 0; i < m_WorkerThreadCount; i++) 136 for (uint i = 0; i < m_WorkerThreadCount; i++)
172 { 137 {
173 m_workerThreads[i] 138 m_workerThreads[i]
174 = Watchdog.StartThread( 139 = WorkManager.StartThread(
175 PoolWorkerJob, 140 PoolWorkerJob,
176 string.Format("PollServiceWorkerThread {0}:{1}", i, m_server.Port), 141 string.Format("PollServiceWorkerThread {0}:{1}", i, m_server.Port),
177 ThreadPriority.Normal, 142 ThreadPriority.Normal,
@@ -181,7 +146,7 @@ namespace OpenSim.Framework.Servers.HttpServer
181 int.MaxValue); 146 int.MaxValue);
182 } 147 }
183 148
184 m_retrysThread = Watchdog.StartThread( 149 m_retrysThread = WorkManager.StartThread(
185 this.CheckRetries, 150 this.CheckRetries,
186 string.Format("PollServiceWatcherThread:{0}", m_server.Port), 151 string.Format("PollServiceWatcherThread:{0}", m_server.Port),
187 ThreadPriority.Normal, 152 ThreadPriority.Normal,
@@ -189,7 +154,7 @@ namespace OpenSim.Framework.Servers.HttpServer
189 true, 154 true,
190 null, 155 null,
191 1000 * 60 * 10); 156 1000 * 60 * 10);
192>>>>>>> avn/ubitvar 157
193 } 158 }
194 159
195 private void ReQueueEvent(PollServiceHttpRequest req) 160 private void ReQueueEvent(PollServiceHttpRequest req)
@@ -258,36 +223,13 @@ namespace OpenSim.Framework.Servers.HttpServer
258 223
259 private void CheckRetries() 224 private void CheckRetries()
260 { 225 {
261<<<<<<< HEAD
262 // The only purpose of this thread is to check the EQs for events.
263 // If there are events, that thread will be placed in the "ready-to-serve" queue, m_requests.
264 // If there are no events, that thread will be back to its "waiting" queue, m_longPollRequests.
265 // All other types of tasks (Inventory handlers, http-in, etc) don't have the long-poll nature,
266 // so if they aren't ready to be served by a worker thread (no events), they are placed
267 // directly back in the "ready-to-serve" queue by the worker thread.
268 while (IsRunning)
269=======
270 while (m_running) 226 while (m_running)
271>>>>>>> avn/ubitvar 227
272 { 228 {
273 Thread.Sleep(100); // let the world move .. back to faster rate 229 Thread.Sleep(100); // let the world move .. back to faster rate
274 Watchdog.UpdateThread(); 230 Watchdog.UpdateThread();
275 lock (m_retryRequests) 231 lock (m_retryRequests)
276 { 232 {
277<<<<<<< HEAD
278 if (m_longPollRequests.Count > 0 && IsRunning)
279 {
280 List<PollServiceHttpRequest> ready = m_longPollRequests.FindAll(req =>
281 (req.PollServiceArgs.HasEvents(req.RequestID, req.PollServiceArgs.Id) || // there are events in this EQ
282 (Environment.TickCount - req.RequestTime) > req.PollServiceArgs.TimeOutms) // no events, but timeout
283 );
284
285 ready.ForEach(req =>
286 {
287 m_requests.Enqueue(req);
288 m_longPollRequests.Remove(req);
289 });
290=======
291 while (m_retryRequests.Count > 0 && m_running) 233 while (m_retryRequests.Count > 0 && m_running)
292 m_requests.Enqueue(m_retryRequests.Dequeue()); 234 m_requests.Enqueue(m_retryRequests.Dequeue());
293 } 235 }
@@ -295,7 +237,6 @@ namespace OpenSim.Framework.Servers.HttpServer
295 if (slowCount >= 10) 237 if (slowCount >= 10)
296 { 238 {
297 slowCount = 0; 239 slowCount = 0;
298>>>>>>> avn/ubitvar
299 240
300 lock (m_slowRequests) 241 lock (m_slowRequests)
301 { 242 {
@@ -308,12 +249,8 @@ namespace OpenSim.Framework.Servers.HttpServer
308 249
309 public void Stop() 250 public void Stop()
310 { 251 {
311<<<<<<< HEAD
312 IsRunning = false;
313// m_timeout = -10000; // cause all to expire
314=======
315 m_running = false; 252 m_running = false;
316>>>>>>> avn/ubitvar 253
317 Thread.Sleep(1000); // let the world move 254 Thread.Sleep(1000); // let the world move
318 255
319 foreach (Thread t in m_workerThreads) 256 foreach (Thread t in m_workerThreads)
@@ -341,13 +278,9 @@ namespace OpenSim.Framework.Servers.HttpServer
341 278
342 lock (m_slowRequests) 279 lock (m_slowRequests)
343 { 280 {
344<<<<<<< HEAD
345 if (m_longPollRequests.Count > 0 && IsRunning)
346 m_longPollRequests.ForEach(req => m_requests.Enqueue(req));
347=======
348 while (m_slowRequests.Count > 0) 281 while (m_slowRequests.Count > 0)
349 m_requests.Enqueue(m_slowRequests.Dequeue()); 282 m_requests.Enqueue(m_slowRequests.Dequeue());
350>>>>>>> avn/ubitvar 283
351 } 284 }
352 285
353 while (m_requests.Count() > 0) 286 while (m_requests.Count() > 0)
@@ -355,13 +288,8 @@ namespace OpenSim.Framework.Servers.HttpServer
355 try 288 try
356 { 289 {
357 wreq = m_requests.Dequeue(0); 290 wreq = m_requests.Dequeue(0);
358<<<<<<< HEAD
359 ResponsesProcessed++;
360 wreq.DoHTTPGruntWork(
361 m_server, wreq.PollServiceArgs.NoEvents(wreq.RequestID, wreq.PollServiceArgs.Id));
362=======
363 wreq.DoHTTPstop(m_server); 291 wreq.DoHTTPstop(m_server);
364>>>>>>> avn/ubitvar 292
365 } 293 }
366 catch 294 catch
367 { 295 {
@@ -375,91 +303,35 @@ namespace OpenSim.Framework.Servers.HttpServer
375 303
376 private void PoolWorkerJob() 304 private void PoolWorkerJob()
377 { 305 {
378 while (IsRunning) 306 while (m_running)
379 { 307 {
380<<<<<<< HEAD
381=======
382 PollServiceHttpRequest req = m_requests.Dequeue(5000); 308 PollServiceHttpRequest req = m_requests.Dequeue(5000);
383 309
384>>>>>>> avn/ubitvar
385 Watchdog.UpdateThread(); 310 Watchdog.UpdateThread();
386 WaitPerformResponse(); 311 if (req != null)
387 }
388 }
389
390 public void WaitPerformResponse()
391 {
392 PollServiceHttpRequest req = m_requests.Dequeue(5000);
393// m_log.DebugFormat("[YYY]: Dequeued {0}", (req == null ? "null" : req.PollServiceArgs.Type.ToString()));
394
395 if (req != null)
396 {
397 try
398 { 312 {
399 if (req.PollServiceArgs.HasEvents(req.RequestID, req.PollServiceArgs.Id)) 313 try
400 { 314 {
401 Hashtable responsedata = req.PollServiceArgs.GetEvents(req.RequestID, req.PollServiceArgs.Id); 315 if (req.PollServiceArgs.HasEvents(req.RequestID, req.PollServiceArgs.Id))
402
403<<<<<<< HEAD
404 if (responsedata == null)
405 return;
406
407 // This is the event queue.
408 // Even if we're not running we can still perform responses by explicit request.
409 if (req.PollServiceArgs.Type == PollServiceEventArgs.EventType.LongPoll
410 || !PerformResponsesAsync)
411 { 316 {
412 try 317 Hashtable responsedata = req.PollServiceArgs.GetEvents(req.RequestID, req.PollServiceArgs.Id);
413 { 318
414 ResponsesProcessed++;
415 req.DoHTTPGruntWork(m_server, responsedata);
416 }
417 catch (ObjectDisposedException e) // Browser aborted before we could read body, server closed the stream
418 {
419 // Ignore it, no need to reply
420 m_log.Error(e);
421 }
422 }
423 else
424 {
425 m_threadPool.QueueWorkItem(x =>
426=======
427 if (req.PollServiceArgs.Type == PollServiceEventArgs.EventType.LongPoll) // This is the event queue 319 if (req.PollServiceArgs.Type == PollServiceEventArgs.EventType.LongPoll) // This is the event queue
428>>>>>>> avn/ubitvar
429 { 320 {
430 try 321 try
431 { 322 {
432 ResponsesProcessed++;
433 req.DoHTTPGruntWork(m_server, responsedata); 323 req.DoHTTPGruntWork(m_server, responsedata);
434 byContextDequeue(req); 324 byContextDequeue(req);
435 } 325 }
436 catch (ObjectDisposedException e) // Browser aborted before we could read body, server closed the stream 326 catch (ObjectDisposedException) // Browser aborted before we could read body, server closed the stream
437 { 327 {
438 // Ignore it, no need to reply 328 // Ignore it, no need to reply
439 m_log.Error(e);
440 } 329 }
441 catch (Exception e) 330 }
331 else
332 {
333 m_threadPool.QueueWorkItem(x =>
442 { 334 {
443<<<<<<< HEAD
444 m_log.Error(e);
445 }
446
447 return null;
448 }, null);
449 }
450 }
451 else
452 {
453 if ((Environment.TickCount - req.RequestTime) > req.PollServiceArgs.TimeOutms)
454 {
455 ResponsesProcessed++;
456 req.DoHTTPGruntWork(
457 m_server, req.PollServiceArgs.NoEvents(req.RequestID, req.PollServiceArgs.Id));
458 }
459 else
460 {
461 ReQueueEvent(req);
462=======
463 try 335 try
464 { 336 {
465 req.DoHTTPGruntWork(m_server, responsedata); 337 req.DoHTTPGruntWork(m_server, responsedata);
@@ -478,7 +350,7 @@ namespace OpenSim.Framework.Servers.HttpServer
478 { 350 {
479 if ((Environment.TickCount - req.RequestTime) > req.PollServiceArgs.TimeOutms) 351 if ((Environment.TickCount - req.RequestTime) > req.PollServiceArgs.TimeOutms)
480 { 352 {
481 req.DoHTTPGruntWork(m_server, 353 req.DoHTTPGruntWork(m_server,
482 req.PollServiceArgs.NoEvents(req.RequestID, req.PollServiceArgs.Id)); 354 req.PollServiceArgs.NoEvents(req.RequestID, req.PollServiceArgs.Id));
483 byContextDequeue(req); 355 byContextDequeue(req);
484 } 356 }
@@ -486,17 +358,15 @@ namespace OpenSim.Framework.Servers.HttpServer
486 { 358 {
487 ReQueueEvent(req); 359 ReQueueEvent(req);
488 } 360 }
489>>>>>>> avn/ubitvar
490 } 361 }
491 } 362 }
492 } 363 catch (Exception e)
493 catch (Exception e) 364 {
494 { 365 m_log.ErrorFormat("Exception in poll service thread: " + e.ToString());
495 m_log.ErrorFormat("Exception in poll service thread: " + e.ToString()); 366 }
496 } 367 }
497 } 368 }
498 } 369 }
499 370
500 } 371 }
501} 372}
502
diff --git a/OpenSim/Framework/Servers/Tests/OSHttpTests.cs b/OpenSim/Framework/Servers/Tests/OSHttpTests.cs
index e13551c..1b47cc6 100644
--- a/OpenSim/Framework/Servers/Tests/OSHttpTests.cs
+++ b/OpenSim/Framework/Servers/Tests/OSHttpTests.cs
@@ -41,9 +41,6 @@ namespace OpenSim.Framework.Servers.Tests
41{ 41{
42 [TestFixture] 42 [TestFixture]
43 public class OSHttpTests : OpenSimTestCase 43 public class OSHttpTests : OpenSimTestCase
44<<<<<<< HEAD
45 {
46=======
47 { 44 {
48 // we need an IHttpClientContext for our tests 45 // we need an IHttpClientContext for our tests
49 public class TestHttpClientContext: IHttpClientContext 46 public class TestHttpClientContext: IHttpClientContext
@@ -363,9 +360,8 @@ namespace OpenSim.Framework.Servers.Tests
363 public void Redirect(Uri uri) {} 360 public void Redirect(Uri uri) {}
364 public void Redirect(string url) {} 361 public void Redirect(string url) {}
365 } 362 }
363
366 364
367
368>>>>>>> avn/ubitvar
369 public OSHttpRequest req0; 365 public OSHttpRequest req0;
370 public OSHttpRequest req1; 366 public OSHttpRequest req1;
371 367