From e0a06f641668cd5c25a7854af2faf8a61c4053ee Mon Sep 17 00:00:00 2001 From: Dr Scofield Date: Tue, 5 May 2009 16:17:52 +0000 Subject: - moving banned check and public/private check to Scene.NewUserConnection() - adding reason reporting this enforces estate bans very early on and prevents us from circulating client objects that we'd then have to retract once we realize that the client is not allowed into the region --- .../Communications/Clients/RegionClient.cs | 29 ++++++++++++++++------ 1 file changed, 21 insertions(+), 8 deletions(-) (limited to 'OpenSim/Framework/Communications/Clients') diff --git a/OpenSim/Framework/Communications/Clients/RegionClient.cs b/OpenSim/Framework/Communications/Clients/RegionClient.cs index da3f620..6fdacb1 100644 --- a/OpenSim/Framework/Communications/Clients/RegionClient.cs +++ b/OpenSim/Framework/Communications/Clients/RegionClient.cs @@ -43,7 +43,7 @@ namespace OpenSim.Framework.Communications.Clients { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - public bool DoCreateChildAgentCall(RegionInfo region, AgentCircuitData aCircuit, string authKey) + public bool DoCreateChildAgentCall(RegionInfo region, AgentCircuitData aCircuit, string authKey, out string reason) { // Eventually, we want to use a caps url instead of the agentID string uri = "http://" + region.ExternalEndPoint.Address + ":" + region.HttpPort + "/agent/" + aCircuit.AgentID + "/"; @@ -56,6 +56,8 @@ namespace OpenSim.Framework.Communications.Clients //AgentCreateRequest.KeepAlive = false; AgentCreateRequest.Headers.Add("Authorization", authKey); + reason = String.Empty; + // Fill it in OSDMap args = null; try @@ -98,7 +100,7 @@ namespace OpenSim.Framework.Communications.Clients catch { //m_log.InfoFormat("[REST COMMS]: Bad send on ChildAgentUpdate {0}", ex.Message); - + reason = "cannot contact remote region"; return false; } @@ -112,13 +114,24 @@ namespace OpenSim.Framework.Communications.Clients { m_log.Info("[REST COMMS]: Null reply on DoCreateChildAgentCall post"); } + else + { - StreamReader sr = new StreamReader(webResponse.GetResponseStream()); - //reply = sr.ReadToEnd().Trim(); - sr.ReadToEnd().Trim(); - sr.Close(); - //m_log.InfoFormat("[REST COMMS]: DoCreateChildAgentCall reply was {0} ", reply); - + StreamReader sr = new StreamReader(webResponse.GetResponseStream()); + string response = sr.ReadToEnd().Trim(); + sr.Close(); + m_log.InfoFormat("[REST COMMS]: DoCreateChildAgentCall reply was {0} ", response); + + if (!String.IsNullOrEmpty(response)) + { + // we assume we got an OSDMap back + OSDMap r = GetOSDMap(response); + bool success = r["success"].AsBoolean(); + reason = r["reason"].AsString(); + + return success; + } + } } catch (WebException ex) { -- cgit v1.1