From f8c569dc7c825d7ee8bf0fcbc225e3ec0f379862 Mon Sep 17 00:00:00 2001 From: Adam Frisby Date: Sat, 23 May 2009 05:18:37 +0000 Subject: * NetworkUtil now handles an error case in a way which is easier to debug. --- OpenSim/Framework/NetworkUtil.cs | 14 +++++++++++--- OpenSim/Region/Communications/OGS1/OGS1GridServices.cs | 1 - 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/OpenSim/Framework/NetworkUtil.cs b/OpenSim/Framework/NetworkUtil.cs index 1abf0d8..759c52f 100644 --- a/OpenSim/Framework/NetworkUtil.cs +++ b/OpenSim/Framework/NetworkUtil.cs @@ -1,4 +1,5 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; using System.Net.Sockets; using System.Net; using System.Net.NetworkInformation; @@ -65,8 +66,15 @@ namespace OpenSim.Framework return subnet.Key; } - // None found. Assume outside network. - return null; + // Check to see if we can find a IPv4 address. + foreach (IPAddress host in Dns.GetHostAddresses(defaultHostname)) + { + if (host.AddressFamily == AddressFamily.InterNetwork) + return host; + } + + // Unable to find anything. + throw new ArgumentException("[NetworkUtil] Unable to resolve defaultHostname to an IPv4 address for an IPv4 client"); } static NetworkUtil() diff --git a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs index 3067d75..684d42b 100644 --- a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs +++ b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs @@ -31,7 +31,6 @@ using System.Collections.Generic; using System.Net; using System.Net.Sockets; using System.Reflection; -using System.Security.Authentication; using log4net; using Nwc.XmlRpc; using OpenMetaverse; -- cgit v1.1