diff options
author | Melanie | 2009-09-21 18:11:40 +0100 |
---|---|---|
committer | Melanie | 2009-09-21 18:11:40 +0100 |
commit | bc9e4cfd961e6ed0184165e4f3cbb770b47a8dff (patch) | |
tree | 3c66054deffbafcc10354880d33676e03f9341a9 /OpenSim/Framework | |
parent | Add a UUID param to NoEvents in PollServiceEventArgs to make it more generic (diff) | |
download | opensim-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.
Diffstat (limited to 'OpenSim/Framework')
5 files changed, 15 insertions, 12 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; | |||
30 | using OpenMetaverse; | 30 | using OpenMetaverse; |
31 | namespace OpenSim.Framework.Servers.HttpServer | 31 | namespace 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 | ||
28 | using System; | 28 | using System; |
29 | using HttpServer; | 29 | using HttpServer; |
30 | using OpenMetaverse; | ||
30 | 31 | ||
31 | namespace OpenSim.Framework.Servers.HttpServer | 32 | namespace 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 |