aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorMelanie2012-07-05 23:09:20 +0200
committerMelanie2012-07-05 23:09:20 +0200
commit4854d779041e987ae13de4f30a37e4fab1b7a3d7 (patch)
tree6e05bd38feb13797c5137d70a13e4e09bfe94745
parent use the pollEvent timeout paramenter on pooling (diff)
downloadopensim-SC-4854d779041e987ae13de4f30a37e4fab1b7a3d7.zip
opensim-SC-4854d779041e987ae13de4f30a37e4fab1b7a3d7.tar.gz
opensim-SC-4854d779041e987ae13de4f30a37e4fab1b7a3d7.tar.bz2
opensim-SC-4854d779041e987ae13de4f30a37e4fab1b7a3d7.tar.xz
Add an EventType enum and Type field to the poll service event args. This allows
the manager to tell what type of event it is. All events except for lsl http in go to the "slow queue" which is run once per second as before.
-rw-r--r--OpenSim/Framework/Servers/HttpServer/PollServiceEventArgs.cs8
-rw-r--r--OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs37
-rw-r--r--OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs8
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs2
4 files changed, 39 insertions, 16 deletions
diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceEventArgs.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceEventArgs.cs
index 2407533..7c92a50 100644
--- a/OpenSim/Framework/Servers/HttpServer/PollServiceEventArgs.cs
+++ b/OpenSim/Framework/Servers/HttpServer/PollServiceEventArgs.cs
@@ -45,6 +45,13 @@ namespace OpenSim.Framework.Servers.HttpServer
45 public RequestMethod Request; 45 public RequestMethod Request;
46 public UUID Id; 46 public UUID Id;
47 public int TimeOutms; 47 public int TimeOutms;
48 public EventType Type;
49
50 public enum EventType : int
51 {
52 Normal = 0,
53 LslHttp = 1
54 }
48 55
49 public PollServiceEventArgs(RequestMethod pRequest, HasEventsMethod pHasEvents, GetEventsMethod pGetEvents, NoEventsMethod pNoEvents, UUID pId, int pTimeOutms) 56 public PollServiceEventArgs(RequestMethod pRequest, HasEventsMethod pHasEvents, GetEventsMethod pGetEvents, NoEventsMethod pNoEvents, UUID pId, int pTimeOutms)
50 { 57 {
@@ -54,6 +61,7 @@ namespace OpenSim.Framework.Servers.HttpServer
54 NoEvents = pNoEvents; 61 NoEvents = pNoEvents;
55 Id = pId; 62 Id = pId;
56 TimeOutms = pTimeOutms; 63 TimeOutms = pTimeOutms;
64 Type = EventType.Normal;
57 } 65 }
58 } 66 }
59} 67}
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;
diff --git a/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs b/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs
index e93266c..9c5596b 100644
--- a/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs
+++ b/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs
@@ -172,9 +172,9 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
172 172
173 string uri = "/lslhttp/" + urlcode.ToString(); 173 string uri = "/lslhttp/" + urlcode.ToString();
174 174
175 m_HttpServer.AddPollServiceHTTPHandler( 175 PollServiceEventArgs args = new PollServiceEventArgs(HttpRequestHandler, HasEvents, GetEvents, NoEvents, urlcode, 25000);
176 uri, 176 args.Type = PollServiceEventArgs.EventType.LslHttp;
177 new PollServiceEventArgs(HttpRequestHandler, HasEvents, GetEvents, NoEvents, urlcode,25000)); 177 m_HttpServer.AddPollServiceHTTPHandler(uri, args);
178 178
179 engine.PostScriptEvent(itemID, "http_request", new Object[] { urlcode.ToString(), "URL_REQUEST_GRANTED", url }); 179 engine.PostScriptEvent(itemID, "http_request", new Object[] { urlcode.ToString(), "URL_REQUEST_GRANTED", url });
180 } 180 }
@@ -422,7 +422,7 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
422 } 422 }
423 private Hashtable GetEvents(UUID requestID, UUID sessionID, string request) 423 private Hashtable GetEvents(UUID requestID, UUID sessionID, string request)
424 { 424 {
425 UrlData url = null; 425 UrlData url = null;
426 RequestData requestData = null; 426 RequestData requestData = null;
427 427
428 lock (m_RequestMap) 428 lock (m_RequestMap)
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index fd8e586..5808594 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -7479,7 +7479,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7479 public LSL_String llSHA1String(string src) 7479 public LSL_String llSHA1String(string src)
7480 { 7480 {
7481 m_host.AddScriptLPS(1); 7481 m_host.AddScriptLPS(1);
7482 return Util.SHA1Hash(src, Encoding.UTF8).ToUpper(); 7482 return Util.SHA1Hash(src, Encoding.UTF8).ToLower();
7483 } 7483 }
7484 7484
7485 protected ObjectShapePacket.ObjectDataBlock SetPrimitiveBlockShapeParams(SceneObjectPart part, int holeshape, LSL_Vector cut, float hollow, LSL_Vector twist, byte profileshape, byte pathcurve) 7485 protected ObjectShapePacket.ObjectDataBlock SetPrimitiveBlockShapeParams(SceneObjectPart part, int holeshape, LSL_Vector cut, float hollow, LSL_Vector twist, byte profileshape, byte pathcurve)