Add a RequestID (UUID.Random()) to the PollRequest and pass it to all
even hander delegates.remotes/origin/0.6.7-post-fixes
parent
04170521f0
commit
bc9e4cfd96
|
@ -370,7 +370,7 @@ namespace OpenSim.Framework.Console
|
|||
}
|
||||
}
|
||||
|
||||
private bool HasEvents(UUID sessionID)
|
||||
private bool HasEvents(UUID RequestID, UUID sessionID)
|
||||
{
|
||||
ConsoleConnection c = null;
|
||||
|
||||
|
@ -386,19 +386,19 @@ namespace OpenSim.Framework.Console
|
|||
return false;
|
||||
}
|
||||
|
||||
private Hashtable GetEvents(UUID sessionID, string request)
|
||||
private Hashtable GetEvents(UUID RequestID, UUID sessionID, string request)
|
||||
{
|
||||
ConsoleConnection c = null;
|
||||
|
||||
lock (m_Connections)
|
||||
{
|
||||
if (!m_Connections.ContainsKey(sessionID))
|
||||
return NoEvents(UUID.Zero);
|
||||
return NoEvents(RequestID, UUID.Zero);
|
||||
c = m_Connections[sessionID];
|
||||
}
|
||||
c.last = System.Environment.TickCount;
|
||||
if (c.lastLineSeen >= m_LineNumber)
|
||||
return NoEvents(UUID.Zero);
|
||||
return NoEvents(RequestID, UUID.Zero);
|
||||
|
||||
Hashtable result = new Hashtable();
|
||||
|
||||
|
@ -440,7 +440,7 @@ namespace OpenSim.Framework.Console
|
|||
return result;
|
||||
}
|
||||
|
||||
private Hashtable NoEvents(UUID id)
|
||||
private Hashtable NoEvents(UUID RequestID, UUID id)
|
||||
{
|
||||
Hashtable result = new Hashtable();
|
||||
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -326,7 +326,7 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue
|
|||
}
|
||||
}
|
||||
|
||||
public bool HasEvents(UUID agentID)
|
||||
public bool HasEvents(UUID requestID, UUID agentID)
|
||||
{
|
||||
// Don't use this, because of race conditions at agent closing time
|
||||
//Queue<OSD> queue = TryGetQueue(agentID);
|
||||
|
@ -343,14 +343,14 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue
|
|||
return false;
|
||||
}
|
||||
|
||||
public Hashtable GetEvents(UUID pAgentId, string request)
|
||||
public Hashtable GetEvents(UUID requestID, UUID pAgentId, string request)
|
||||
{
|
||||
Queue<OSD> queue = TryGetQueue(pAgentId);
|
||||
OSD element;
|
||||
lock (queue)
|
||||
{
|
||||
if (queue.Count == 0)
|
||||
return NoEvents(pAgentId);
|
||||
return NoEvents(requestID, pAgentId);
|
||||
element = queue.Dequeue(); // 15s timeout
|
||||
}
|
||||
|
||||
|
@ -398,7 +398,7 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue
|
|||
//m_log.DebugFormat("[EVENTQUEUE]: sending response for {0} in region {1}: {2}", agentID, m_scene.RegionInfo.RegionName, responsedata["str_response_string"]);
|
||||
}
|
||||
|
||||
public Hashtable NoEvents(UUID agentID)
|
||||
public Hashtable NoEvents(UUID requestID, UUID agentID)
|
||||
{
|
||||
Hashtable responsedata = new Hashtable();
|
||||
responsedata["int_response_code"] = 502;
|
||||
|
|
Loading…
Reference in New Issue