aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorMelanie2009-09-21 18:11:40 +0100
committerMelanie2009-09-21 18:11:40 +0100
commitbc9e4cfd961e6ed0184165e4f3cbb770b47a8dff (patch)
tree3c66054deffbafcc10354880d33676e03f9341a9
parentAdd a UUID param to NoEvents in PollServiceEventArgs to make it more generic (diff)
downloadopensim-SC_OLD-bc9e4cfd961e6ed0184165e4f3cbb770b47a8dff.zip
opensim-SC_OLD-bc9e4cfd961e6ed0184165e4f3cbb770b47a8dff.tar.gz
opensim-SC_OLD-bc9e4cfd961e6ed0184165e4f3cbb770b47a8dff.tar.bz2
opensim-SC_OLD-bc9e4cfd961e6ed0184165e4f3cbb770b47a8dff.tar.xz
Add a RequestID (UUID.Random()) to the PollRequest and pass it to all
even hander delegates.
-rw-r--r--OpenSim/Framework/Console/RemoteConsole.cs10
-rw-r--r--OpenSim/Framework/Servers/HttpServer/PollServiceEventArgs.cs6
-rw-r--r--OpenSim/Framework/Servers/HttpServer/PollServiceHttpRequest.cs3
-rw-r--r--OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs2
-rw-r--r--OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs6
-rw-r--r--OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueGetModule.cs8
6 files changed, 19 insertions, 16 deletions
diff --git a/OpenSim/Framework/Console/RemoteConsole.cs b/OpenSim/Framework/Console/RemoteConsole.cs
index 5a18b94..76276a5 100644
--- a/OpenSim/Framework/Console/RemoteConsole.cs
+++ b/OpenSim/Framework/Console/RemoteConsole.cs
@@ -370,7 +370,7 @@ namespace OpenSim.Framework.Console
370 } 370 }
371 } 371 }
372 372
373 private bool HasEvents(UUID sessionID) 373 private bool HasEvents(UUID RequestID, UUID sessionID)
374 { 374 {
375 ConsoleConnection c = null; 375 ConsoleConnection c = null;
376 376
@@ -386,19 +386,19 @@ namespace OpenSim.Framework.Console
386 return false; 386 return false;
387 } 387 }
388 388
389 private Hashtable GetEvents(UUID sessionID, string request) 389 private Hashtable GetEvents(UUID RequestID, UUID sessionID, string request)
390 { 390 {
391 ConsoleConnection c = null; 391 ConsoleConnection c = null;
392 392
393 lock (m_Connections) 393 lock (m_Connections)
394 { 394 {
395 if (!m_Connections.ContainsKey(sessionID)) 395 if (!m_Connections.ContainsKey(sessionID))
396 return NoEvents(UUID.Zero); 396 return NoEvents(RequestID, UUID.Zero);
397 c = m_Connections[sessionID]; 397 c = m_Connections[sessionID];
398 } 398 }
399 c.last = System.Environment.TickCount; 399 c.last = System.Environment.TickCount;
400 if (c.lastLineSeen >= m_LineNumber) 400 if (c.lastLineSeen >= m_LineNumber)
401 return NoEvents(UUID.Zero); 401 return NoEvents(RequestID, UUID.Zero);
402 402
403 Hashtable result = new Hashtable(); 403 Hashtable result = new Hashtable();
404 404
@@ -440,7 +440,7 @@ namespace OpenSim.Framework.Console
440 return result; 440 return result;
441 } 441 }
442 442
443 private Hashtable NoEvents(UUID id) 443 private Hashtable NoEvents(UUID RequestID, UUID id)
444 { 444 {
445 Hashtable result = new Hashtable(); 445 Hashtable result = new Hashtable();
446 446
diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceEventArgs.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceEventArgs.cs
index ed387d1..61cb8aa 100644
--- a/OpenSim/Framework/Servers/HttpServer/PollServiceEventArgs.cs
+++ b/OpenSim/Framework/Servers/HttpServer/PollServiceEventArgs.cs
@@ -30,11 +30,11 @@ using System.Collections;
30using OpenMetaverse; 30using OpenMetaverse;
31namespace OpenSim.Framework.Servers.HttpServer 31namespace OpenSim.Framework.Servers.HttpServer
32{ 32{
33 public delegate bool HasEventsMethod(UUID pId); 33 public delegate bool HasEventsMethod(UUID requestID, UUID pId);
34 34
35 public delegate Hashtable GetEventsMethod(UUID pId, string request); 35 public delegate Hashtable GetEventsMethod(UUID requestID, UUID pId, string request);
36 36
37 public delegate Hashtable NoEventsMethod(UUID pId); 37 public delegate Hashtable NoEventsMethod(UUID requestID, UUID pId);
38 38
39 public class PollServiceEventArgs : EventArgs 39 public class PollServiceEventArgs : EventArgs
40 { 40 {
diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceHttpRequest.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceHttpRequest.cs
index ff7c1e8..553a7eb 100644
--- a/OpenSim/Framework/Servers/HttpServer/PollServiceHttpRequest.cs
+++ b/OpenSim/Framework/Servers/HttpServer/PollServiceHttpRequest.cs
@@ -27,6 +27,7 @@
27 27
28using System; 28using System;
29using HttpServer; 29using HttpServer;
30using OpenMetaverse;
30 31
31namespace OpenSim.Framework.Servers.HttpServer 32namespace OpenSim.Framework.Servers.HttpServer
32{ 33{
@@ -37,12 +38,14 @@ namespace OpenSim.Framework.Servers.HttpServer
37 public readonly IHttpClientContext HttpContext; 38 public readonly IHttpClientContext HttpContext;
38 public readonly IHttpRequest Request; 39 public readonly IHttpRequest Request;
39 public readonly int RequestTime; 40 public readonly int RequestTime;
41 public readonly UUID RequestID;
40 public PollServiceHttpRequest(PollServiceEventArgs pPollServiceArgs, IHttpClientContext pHttpContext, IHttpRequest pRequest) 42 public PollServiceHttpRequest(PollServiceEventArgs pPollServiceArgs, IHttpClientContext pHttpContext, IHttpRequest pRequest)
41 { 43 {
42 PollServiceArgs = pPollServiceArgs; 44 PollServiceArgs = pPollServiceArgs;
43 HttpContext = pHttpContext; 45 HttpContext = pHttpContext;
44 Request = pRequest; 46 Request = pRequest;
45 RequestTime = System.Environment.TickCount; 47 RequestTime = System.Environment.TickCount;
48 RequestID = UUID.Random();
46 } 49 }
47 } 50 }
48} 51}
diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs
index db80f1d..1c54581 100644
--- a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs
+++ b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs
@@ -130,7 +130,7 @@ namespace OpenSim.Framework.Servers.HttpServer
130 foreach (object o in m_requests) 130 foreach (object o in m_requests)
131 { 131 {
132 PollServiceHttpRequest req = (PollServiceHttpRequest) o; 132 PollServiceHttpRequest req = (PollServiceHttpRequest) o;
133 m_server.DoHTTPGruntWork(req.PollServiceArgs.NoEvents(req.PollServiceArgs.Id), new OSHttpResponse(new HttpResponse(req.HttpContext, req.Request), req.HttpContext)); 133 m_server.DoHTTPGruntWork(req.PollServiceArgs.NoEvents(req.RequestID, req.PollServiceArgs.Id), new OSHttpResponse(new HttpResponse(req.HttpContext, req.Request), req.HttpContext));
134 } 134 }
135 135
136 m_requests.Clear(); 136 m_requests.Clear();
diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs
index 1e8706c..ce32443 100644
--- a/OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs
+++ b/OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs
@@ -100,11 +100,11 @@ namespace OpenSim.Framework.Servers.HttpServer
100 PollServiceHttpRequest req = m_request.Dequeue(); 100 PollServiceHttpRequest req = m_request.Dequeue();
101 try 101 try
102 { 102 {
103 if (req.PollServiceArgs.HasEvents(req.PollServiceArgs.Id)) 103 if (req.PollServiceArgs.HasEvents(req.RequestID, req.PollServiceArgs.Id))
104 { 104 {
105 StreamReader str = new StreamReader(req.Request.Body); 105 StreamReader str = new StreamReader(req.Request.Body);
106 106
107 Hashtable responsedata = req.PollServiceArgs.GetEvents(req.PollServiceArgs.Id, str.ReadToEnd()); 107 Hashtable responsedata = req.PollServiceArgs.GetEvents(req.RequestID, req.PollServiceArgs.Id, str.ReadToEnd());
108 m_server.DoHTTPGruntWork(responsedata, 108 m_server.DoHTTPGruntWork(responsedata,
109 new OSHttpResponse(new HttpResponse(req.HttpContext, req.Request),req.HttpContext)); 109 new OSHttpResponse(new HttpResponse(req.HttpContext, req.Request),req.HttpContext));
110 } 110 }
@@ -112,7 +112,7 @@ namespace OpenSim.Framework.Servers.HttpServer
112 { 112 {
113 if ((Environment.TickCount - req.RequestTime) > m_timeout) 113 if ((Environment.TickCount - req.RequestTime) > m_timeout)
114 { 114 {
115 m_server.DoHTTPGruntWork(req.PollServiceArgs.NoEvents(req.PollServiceArgs.Id), 115 m_server.DoHTTPGruntWork(req.PollServiceArgs.NoEvents(req.RequestID, req.PollServiceArgs.Id),
116 new OSHttpResponse(new HttpResponse(req.HttpContext, req.Request),req.HttpContext)); 116 new OSHttpResponse(new HttpResponse(req.HttpContext, req.Request),req.HttpContext));
117 } 117 }
118 else 118 else
diff --git a/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueGetModule.cs b/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueGetModule.cs
index 26eed42..55ea4b7 100644
--- a/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueGetModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueGetModule.cs
@@ -326,7 +326,7 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue
326 } 326 }
327 } 327 }
328 328
329 public bool HasEvents(UUID agentID) 329 public bool HasEvents(UUID requestID, UUID agentID)
330 { 330 {
331 // Don't use this, because of race conditions at agent closing time 331 // Don't use this, because of race conditions at agent closing time
332 //Queue<OSD> queue = TryGetQueue(agentID); 332 //Queue<OSD> queue = TryGetQueue(agentID);
@@ -343,14 +343,14 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue
343 return false; 343 return false;
344 } 344 }
345 345
346 public Hashtable GetEvents(UUID pAgentId, string request) 346 public Hashtable GetEvents(UUID requestID, UUID pAgentId, string request)
347 { 347 {
348 Queue<OSD> queue = TryGetQueue(pAgentId); 348 Queue<OSD> queue = TryGetQueue(pAgentId);
349 OSD element; 349 OSD element;
350 lock (queue) 350 lock (queue)
351 { 351 {
352 if (queue.Count == 0) 352 if (queue.Count == 0)
353 return NoEvents(pAgentId); 353 return NoEvents(requestID, pAgentId);
354 element = queue.Dequeue(); // 15s timeout 354 element = queue.Dequeue(); // 15s timeout
355 } 355 }
356 356
@@ -398,7 +398,7 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue
398 //m_log.DebugFormat("[EVENTQUEUE]: sending response for {0} in region {1}: {2}", agentID, m_scene.RegionInfo.RegionName, responsedata["str_response_string"]); 398 //m_log.DebugFormat("[EVENTQUEUE]: sending response for {0} in region {1}: {2}", agentID, m_scene.RegionInfo.RegionName, responsedata["str_response_string"]);
399 } 399 }
400 400
401 public Hashtable NoEvents(UUID agentID) 401 public Hashtable NoEvents(UUID requestID, UUID agentID)
402 { 402 {
403 Hashtable responsedata = new Hashtable(); 403 Hashtable responsedata = new Hashtable();
404 responsedata["int_response_code"] = 502; 404 responsedata["int_response_code"] = 502;