From a33f244b58cae2bd2d704e4fa3f1fcfebd575dfa Mon Sep 17 00:00:00 2001 From: Adam Frisby Date: Sun, 27 May 2007 08:13:55 +0000 Subject: [PATCH] * Inserting "SYSTEMIP" into a simconfig.xml's IPAddress="" section will use the first resolved IP of the system. This is to assist with Adam's lazy-deploy system but may be useful to others. --- OpenSim/OpenSim.RegionServer/RegionInfo.cs | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/OpenSim/OpenSim.RegionServer/RegionInfo.cs b/OpenSim/OpenSim.RegionServer/RegionInfo.cs index 60a5861bda..1608f4b8c7 100644 --- a/OpenSim/OpenSim.RegionServer/RegionInfo.cs +++ b/OpenSim/OpenSim.RegionServer/RegionInfo.cs @@ -173,7 +173,25 @@ namespace OpenSim } else { - this.IPListenAddr = attri; + // Probably belongs elsewhere, but oh well. + if (attri.Trim().StartsWith("SYSTEMIP")) + { + string localhostname = System.Net.Dns.GetHostName(); + System.Net.IPAddress[] ips = System.Net.Dns.GetHostAddresses(localhostname); + try + { + this.IPListenAddr = ips[0].ToString(); + } + catch (Exception e) + { + e.ToString(); + this.IPListenAddr = "127.0.0.1"; // Use the default if we fail + } + } + else + { + this.IPListenAddr = attri; + } } // Terrain Default File