From 7ab1986bf022f74dd2dcbb81df60bc2cad47d2cb Mon Sep 17 00:00:00 2001 From: diva Date: Tue, 26 May 2009 22:39:01 +0000 Subject: Catching weirdnesses on resolving External EndPoint in agent transfers. Will probably need to do more aggressively. --- .../Communications/Clients/RegionClient.cs | 39 +++++++++++++++++++--- 1 file changed, 34 insertions(+), 5 deletions(-) (limited to 'OpenSim/Framework/Communications/Clients') diff --git a/OpenSim/Framework/Communications/Clients/RegionClient.cs b/OpenSim/Framework/Communications/Clients/RegionClient.cs index 5c2babc..4f5a4cf 100644 --- a/OpenSim/Framework/Communications/Clients/RegionClient.cs +++ b/OpenSim/Framework/Communications/Clients/RegionClient.cs @@ -45,8 +45,21 @@ namespace OpenSim.Framework.Communications.Clients public bool DoCreateChildAgentCall(RegionInfo region, AgentCircuitData aCircuit, string authKey, out string reason) { + reason = String.Empty; + // Eventually, we want to use a caps url instead of the agentID - string uri = "http://" + region.ExternalEndPoint.Address + ":" + region.HttpPort + "/agent/" + aCircuit.AgentID + "/"; + string uri = string.Empty; + try + { + uri = "http://" + region.ExternalEndPoint.Address + ":" + region.HttpPort + "/agent/" + aCircuit.AgentID + "/"; + } + catch (Exception e) + { + m_log.Debug("[REST COMMS]: Unable to resolve external endpoint on agent create. Reason: " + e.Message); + reason = e.Message; + return false; + } + //Console.WriteLine(" >>> DoCreateChildAgentCall <<< " + uri); HttpWebRequest AgentCreateRequest = (HttpWebRequest)WebRequest.Create(uri); @@ -56,8 +69,6 @@ namespace OpenSim.Framework.Communications.Clients //AgentCreateRequest.KeepAlive = false; AgentCreateRequest.Headers.Add("Authorization", authKey); - reason = String.Empty; - // Fill it in OSDMap args = null; try @@ -158,7 +169,16 @@ namespace OpenSim.Framework.Communications.Clients public bool DoChildAgentUpdateCall(RegionInfo region, IAgentData cAgentData) { // Eventually, we want to use a caps url instead of the agentID - string uri = "http://" + region.ExternalEndPoint.Address + ":" + region.HttpPort + "/agent/" + cAgentData.AgentID + "/"; + string uri = string.Empty; + try + { + uri = "http://" + region.ExternalEndPoint.Address + ":" + region.HttpPort + "/agent/" + cAgentData.AgentID + "/"; + } + catch (Exception e) + { + m_log.Debug("[REST COMMS]: Unable to resolve external endpoint on agent update. Reason: " + e.Message); + return false; + } //Console.WriteLine(" >>> DoChildAgentUpdateCall <<< " + uri); HttpWebRequest ChildUpdateRequest = (HttpWebRequest)WebRequest.Create(uri); @@ -330,7 +350,16 @@ namespace OpenSim.Framework.Communications.Clients public bool DoCloseAgentCall(RegionInfo region, UUID id) { - string uri = "http://" + region.ExternalEndPoint.Address + ":" + region.HttpPort + "/agent/" + id + "/" + region.RegionHandle.ToString() + "/"; + string uri = string.Empty; + try + { + uri = "http://" + region.ExternalEndPoint.Address + ":" + region.HttpPort + "/agent/" + id + "/" + region.RegionHandle.ToString() + "/"; + } + catch (Exception e) + { + m_log.Debug("[REST COMMS]: Unable to resolve external endpoint on agent close. Reason: " + e.Message); + return false; + } //Console.WriteLine(" >>> DoCloseAgentCall <<< " + uri); -- cgit v1.1