diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs
index 83d9df1..e3d89dc 100644
--- a/OpenSim/Framework/Util.cs
+++ b/OpenSim/Framework/Util.cs
@@ -429,64 +429,6 @@ namespace OpenSim.Framework
return regionCoord << 8;
}
- public static IPEndPoint getEndPoint(IPAddress ia, int port)
- {
- if(ia == null)
- return null;
-
- IPEndPoint newEP = null;
- try
- {
- newEP = new IPEndPoint(ia, port);
- }
- catch
- {
- newEP = null;
- }
- return newEP;
- }
-
- public static IPEndPoint getEndPoint(string hostname, int port)
- {
- IPAddress ia = null;
- // If it is already an IP, don't resolve it - just return directly
- // we should not need this
- if (IPAddress.TryParse(hostname, out ia))
- {
- if (ia.Equals(IPAddress.Any) || ia.Equals(IPAddress.IPv6Any))
- return null;
- return getEndPoint(ia, port);
- }
-
- // Reset for next check
- ia = null;
- try
- {
- foreach (IPAddress Adr in Dns.GetHostAddresses(hostname))
- {
- if (ia == null)
- ia = Adr;
-
- if (Adr.AddressFamily == AddressFamily.InterNetwork)
- {
- ia = Adr;
- break;
- }
- }
- }
- catch // (SocketException e)
- {
- /*throw new Exception(
- "Unable to resolve local hostname " + m_externalHostName + " innerException of type '" +
- e + "' attached to this exception", e);*/
- // Don't throw a fatal exception here, instead, return Null and handle it in the caller.
- // Reason is, on systems such as OSgrid it has occured that known hostnames stop
- // resolving and thus make surrounding regions crash out with this exception.
- return null;
- }
-
- return getEndPoint(ia,port);
- }
public static bool checkServiceURI(string uristr, out string serviceURI)
{
@@ -1066,38 +1008,99 @@ namespace OpenSim.Framework
/// <returns>An IP address, or null</returns>
public static IPAddress GetHostFromDNS(string dnsAddress)
{
- // Is it already a valid IP? No need to look it up.
- IPAddress ipa;
- if (IPAddress.TryParse(dnsAddress, out ipa))
- return ipa;
+ // If it is already an IP, avoid possible broken mono from seeing it
+ IPAddress ia = null;
+ if (IPAddress.TryParse(dnsAddress, out ia) && ia != null)
+ {
+ if (ia.Equals(IPAddress.Any) || ia.Equals(IPAddress.IPv6Any))
+ return null;
+ return ia;
+ }
+ // Reset for next check
+ ia = null;
+ try
+ {
+ foreach (IPAddress Adr in Dns.GetHostAddresses(dnsAddress))
+ {
+ if (ia == null)
+ ia = Adr;
- IPAddress[] hosts = null;
+ if (Adr.AddressFamily == AddressFamily.InterNetwork)
+ {
+ ia = Adr;
+ break;
+ }
+ }
+ }
+ catch // (SocketException e)
+ {
+ /*throw new Exception(
+ "Unable to resolve local hostname " + m_externalHostName + " innerException of type '" +
+ e + "' attached to this exception", e);*/
+ // Don't throw a fatal exception here, instead, return Null and handle it in the caller.
+ // Reason is, on systems such as OSgrid it has occured that known hostnames stop
+ // resolving and thus make surrounding regions crash out with this exception.
+ return null;
+ }
+ return ia;
+ }
+
+ public static IPEndPoint getEndPoint(IPAddress ia, int port)
+ {
+ if(ia == null)
+ return null;
- // Not an IP, lookup required
+ IPEndPoint newEP = null;
try
{
- hosts = Dns.GetHostEntry(dnsAddress).AddressList;
+ newEP = new IPEndPoint(ia, port);
}
- catch (Exception e)
+ catch
{
- m_log.WarnFormat("[UTIL]: An error occurred while resolving host name {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;
+ newEP = null;
}
+ return newEP;
+ }
- foreach (IPAddress host in hosts)
+ public static IPEndPoint getEndPoint(string hostname, int port)
+ {
+ IPAddress ia = null;
+ // If it is already an IP, avoid possible broken mono from seeing it
+ if (IPAddress.TryParse(hostname, out ia) && ia != null)
{
- if (host.AddressFamily == AddressFamily.InterNetwork)
+ if (ia.Equals(IPAddress.Any) || ia.Equals(IPAddress.IPv6Any))
+ return null;
+ return getEndPoint(ia, port);
+ }
+
+ // Reset for next check
+ ia = null;
+ try
+ {
+ foreach (IPAddress Adr in Dns.GetHostAddresses(hostname))
{
- return host;
+ if (ia == null)
+ ia = Adr;
+
+ if (Adr.AddressFamily == AddressFamily.InterNetwork)
+ {
+ ia = Adr;
+ break;
+ }
}
}
+ catch // (SocketException e)
+ {
+ /*throw new Exception(
+ "Unable to resolve local hostname " + m_externalHostName + " innerException of type '" +
+ e + "' attached to this exception", e);*/
+ // Don't throw a fatal exception here, instead, return Null and handle it in the caller.
+ // Reason is, on systems such as OSgrid it has occured that known hostnames stop
+ // resolving and thus make surrounding regions crash out with this exception.
+ return null;
+ }
- if (hosts.Length > 0)
- return hosts[0];
-
- return null;
+ return getEndPoint(ia,port);
}
public static Uri GetURI(string protocol, string hostname, int port, string path)
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs
index c6499cd..5054326 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs
@@ -516,7 +516,7 @@ namespace OpenSim.Region.ClientStack.Linden
if(endPoint == null)
m_log.DebugFormat("EnableSimulator null endpoint");
if(endPoint.Address == null)
- m_log.DebugFormat("EnableSimulator null endpoint");
+ m_log.DebugFormat("EnableSimulator null endpoint address");
OSD item = EventQueueHelper.EnableSimulator(handle, endPoint, regionSizeX, regionSizeY);
Enqueue(item, avatarID);