From bc9e4cfd961e6ed0184165e4f3cbb770b47a8dff Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 21 Sep 2009 18:11:40 +0100 Subject: Add a RequestID (UUID.Random()) to the PollRequest and pass it to all even hander delegates. --- OpenSim/Framework/Servers/HttpServer/PollServiceEventArgs.cs | 6 +++--- OpenSim/Framework/Servers/HttpServer/PollServiceHttpRequest.cs | 3 +++ OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs | 2 +- OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs | 6 +++--- 4 files changed, 10 insertions(+), 7 deletions(-) (limited to 'OpenSim/Framework/Servers/HttpServer') 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; using OpenMetaverse; namespace OpenSim.Framework.Servers.HttpServer { - public delegate bool HasEventsMethod(UUID pId); + public delegate bool HasEventsMethod(UUID requestID, UUID pId); - public delegate Hashtable GetEventsMethod(UUID pId, string request); + public delegate Hashtable GetEventsMethod(UUID requestID, UUID pId, string request); - public delegate Hashtable NoEventsMethod(UUID pId); + public delegate Hashtable NoEventsMethod(UUID requestID, UUID pId); public class PollServiceEventArgs : EventArgs { 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 @@ using System; using HttpServer; +using OpenMetaverse; namespace OpenSim.Framework.Servers.HttpServer { @@ -37,12 +38,14 @@ namespace OpenSim.Framework.Servers.HttpServer public readonly IHttpClientContext HttpContext; public readonly IHttpRequest Request; public readonly int RequestTime; + public readonly UUID RequestID; public PollServiceHttpRequest(PollServiceEventArgs pPollServiceArgs, IHttpClientContext pHttpContext, IHttpRequest pRequest) { PollServiceArgs = pPollServiceArgs; HttpContext = pHttpContext; Request = pRequest; RequestTime = System.Environment.TickCount; + RequestID = UUID.Random(); } } } 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 foreach (object o in m_requests) { PollServiceHttpRequest req = (PollServiceHttpRequest) o; - m_server.DoHTTPGruntWork(req.PollServiceArgs.NoEvents(req.PollServiceArgs.Id), new OSHttpResponse(new HttpResponse(req.HttpContext, req.Request), req.HttpContext)); + m_server.DoHTTPGruntWork(req.PollServiceArgs.NoEvents(req.RequestID, req.PollServiceArgs.Id), new OSHttpResponse(new HttpResponse(req.HttpContext, req.Request), req.HttpContext)); } 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 PollServiceHttpRequest req = m_request.Dequeue(); try { - if (req.PollServiceArgs.HasEvents(req.PollServiceArgs.Id)) + if (req.PollServiceArgs.HasEvents(req.RequestID, req.PollServiceArgs.Id)) { StreamReader str = new StreamReader(req.Request.Body); - Hashtable responsedata = req.PollServiceArgs.GetEvents(req.PollServiceArgs.Id, str.ReadToEnd()); + Hashtable responsedata = req.PollServiceArgs.GetEvents(req.RequestID, req.PollServiceArgs.Id, str.ReadToEnd()); m_server.DoHTTPGruntWork(responsedata, new OSHttpResponse(new HttpResponse(req.HttpContext, req.Request),req.HttpContext)); } @@ -112,7 +112,7 @@ namespace OpenSim.Framework.Servers.HttpServer { if ((Environment.TickCount - req.RequestTime) > m_timeout) { - m_server.DoHTTPGruntWork(req.PollServiceArgs.NoEvents(req.PollServiceArgs.Id), + m_server.DoHTTPGruntWork(req.PollServiceArgs.NoEvents(req.RequestID, req.PollServiceArgs.Id), new OSHttpResponse(new HttpResponse(req.HttpContext, req.Request),req.HttpContext)); } else -- cgit v1.1