* NetworkUtil now handles an error case in a way which is easier to debug.

0.6.6-post-fixes
Adam Frisby 2009-05-23 05:18:37 +00:00
parent 2d06135166
commit f8c569dc7c
2 changed files with 11 additions and 4 deletions

View File

@ -1,4 +1,5 @@
using System.Collections.Generic; using System;
using System.Collections.Generic;
using System.Net.Sockets; using System.Net.Sockets;
using System.Net; using System.Net;
using System.Net.NetworkInformation; using System.Net.NetworkInformation;
@ -65,8 +66,15 @@ namespace OpenSim.Framework
return subnet.Key; return subnet.Key;
} }
// None found. Assume outside network. // Check to see if we can find a IPv4 address.
return null; 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() static NetworkUtil()

View File

@ -31,7 +31,6 @@ using System.Collections.Generic;
using System.Net; using System.Net;
using System.Net.Sockets; using System.Net.Sockets;
using System.Reflection; using System.Reflection;
using System.Security.Authentication;
using log4net; using log4net;
using Nwc.XmlRpc; using Nwc.XmlRpc;
using OpenMetaverse; using OpenMetaverse;