From 4df1d25d23d76ee3ae8c7da155462b57735f6418 Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 9 Dec 2010 01:55:32 +0000 Subject: Plumb a code path for the entity transfer module to ask a destination scene whether or not an agent is allowed there as a root agent. --- .../Simulation/SimulationServiceConnector.cs | 59 ++++++++++++++++++++++ 1 file changed, 59 insertions(+) (limited to 'OpenSim/Services/Connectors/Simulation') diff --git a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs index 3b907c1..e2032d9 100644 --- a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs +++ b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs @@ -409,6 +409,65 @@ namespace OpenSim.Services.Connectors.Simulation return false; } + public bool QueryAccess(GridRegion destination, UUID id) + { + IPEndPoint ext = destination.ExternalEndPoint; + if (ext == null) return false; + // Eventually, we want to use a caps url instead of the agentID + string uri = destination.ServerURI + AgentPath() + id + "/" + destination.RegionID.ToString() + "/"; + + HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri); + request.Method = "QUERYACCESS"; + request.Timeout = 10000; + //request.Headers.Add("authorization", ""); // coming soon + + HttpWebResponse webResponse = null; + string reply = string.Empty; + StreamReader sr = null; + try + { + webResponse = (HttpWebResponse)request.GetResponse(); + if (webResponse == null) + { + m_log.Debug("[REMOTE SIMULATION CONNECTOR]: Null reply on agent query "); + } + + sr = new StreamReader(webResponse.GetResponseStream()); + reply = sr.ReadToEnd().Trim(); + + + } + catch (WebException ex) + { + m_log.WarnFormat("[REMOTE SIMULATION CONNECTOR]: exception on reply of agent query {0}", ex.Message); + // ignore, really + return false; + } + finally + { + if (sr != null) + sr.Close(); + } + + if (webResponse.StatusCode == HttpStatusCode.OK) + { + try + { + bool result; + + result = bool.Parse(reply); + + return result; + } + catch + { + return false; + } + } + + return false; + } + public bool ReleaseAgent(UUID origin, UUID id, string uri) { WebRequest request = WebRequest.Create(uri); -- cgit v1.1