From 5c52068dd7a3bea8ff31e78bf933a985ef97f1b4 Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Mon, 14 Apr 2008 15:32:39 +0000 Subject: * Get Util.GetHostFromDNS to tell us the dns address it was trying to resolve if it fails. --- OpenSim/Framework/Util.cs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index a184f89..ac1145f 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs @@ -43,6 +43,8 @@ namespace OpenSim.Framework { public class Util { + private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + private static Random randomClass = new Random(); private static uint nextXferID = 5000; private static object XferLock = new object(); @@ -327,8 +329,20 @@ namespace OpenSim.Framework if (IPAddress.TryParse(dnsAddress, out ipa)) return ipa; + IPAddress[] hosts = null; + // Not an IP, lookup required - IPAddress[] hosts = Dns.GetHostEntry(dnsAddress).AddressList; + try + { + hosts = Dns.GetHostEntry(dnsAddress).AddressList; + } + catch (Exception e) + { + m_log.ErrorFormat("[UTIL]: An error occurred while resolving {0}, {1}", dnsAddress, e); + + // Still going to throw the exception on for now, since this was what was happening in the first place + throw e; + } foreach (IPAddress host in hosts) { -- cgit v1.1