From 6b312d934085caf1add5e6081f55c9944ab01aa9 Mon Sep 17 00:00:00 2001 From: Adam Frisby Date: Sat, 23 May 2009 06:29:08 +0000 Subject: * Implements automatic loopback handling for standalone regions. * This /should/ make OpenSim behave properly when hosting behind a NAT router and utilizing port forwarding (but the router doesn't support Loopback) --- .../Framework/Scenes/SceneCommunicationService.cs | 29 ++++++++++++++++------ 1 file changed, 22 insertions(+), 7 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs index 85a3d96..b89a5f2 100644 --- a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs +++ b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs @@ -812,17 +812,32 @@ namespace OpenSim.Region.Framework.Scenes if (Util.IsOutsideView(oldRegionX, newRegionX, oldRegionY, newRegionY)) { - capsPath - = "http://" - + reg.ExternalHostName - + ":" - + reg.HttpPort - + CapsUtil.GetCapsSeedPath(agentCircuit.CapsPath); + #region IP Translation for NAT + IClientIPEndpoint ipepClient; + if (avatar.ClientView.TryGet(out ipepClient)) + { + capsPath + = "http://" + + NetworkUtil.GetHostFor(ipepClient.EndPoint, reg.ExternalHostName) + + ":" + + reg.HttpPort + + CapsUtil.GetCapsSeedPath(agentCircuit.CapsPath); + } + else + { + capsPath + = "http://" + + reg.ExternalHostName + + ":" + + reg.HttpPort + + CapsUtil.GetCapsSeedPath(agentCircuit.CapsPath); + } + #endregion if (eq != null) { #region IP Translation for NAT - IClientIPEndpoint ipepClient; + // Uses ipepClient above if (avatar.ClientView.TryGet(out ipepClient)) { endPoint.Address = NetworkUtil.GetIPFor(ipepClient.EndPoint, endPoint.Address); -- cgit v1.1