diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index e3d89dc059..3ddeafbb4f 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs @@ -1064,6 +1064,9 @@ namespace OpenSim.Framework public static IPEndPoint getEndPoint(string hostname, int port) { + if(String.IsNullOrWhiteSpace(hostname)) + return null; + IPAddress ia = null; // If it is already an IP, avoid possible broken mono from seeing it if (IPAddress.TryParse(hostname, out ia) && ia != null) @@ -1075,31 +1078,31 @@ namespace OpenSim.Framework // Reset for next check ia = null; - try +#if (_MONO) + // mono is a TOTAL CRAP + int retry = 3; + while(ia == null && retry-- >= 0) +#endif { - foreach (IPAddress Adr in Dns.GetHostAddresses(hostname)) + try { - if (ia == null) - ia = Adr; - - if (Adr.AddressFamily == AddressFamily.InterNetwork) + foreach (IPAddress Adr in Dns.GetHostAddresses(hostname)) { - ia = Adr; - break; + if (ia == null) + ia = Adr; + + if (Adr.AddressFamily == AddressFamily.InterNetwork) + { + ia = Adr; + break; + } } } + catch // (SocketException e) + { + ia = null; + } } - 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); } diff --git a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs index 50543269c2..1feece1f70 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs @@ -512,11 +512,6 @@ namespace OpenSim.Region.ClientStack.Linden if (DebugLevel > 0) m_log.DebugFormat("{0} EnableSimulator. handle={1}, endPoint={2}, avatarID={3}", LogHeader, handle, endPoint, avatarID, regionSizeX, regionSizeY); -//debug - if(endPoint == null) - m_log.DebugFormat("EnableSimulator null endpoint"); - if(endPoint.Address == null) - m_log.DebugFormat("EnableSimulator null endpoint address"); OSD item = EventQueueHelper.EnableSimulator(handle, endPoint, regionSizeX, regionSizeY); Enqueue(item, avatarID); diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index b6e9a656b7..0505e586a7 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -2157,6 +2157,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer { Thread.Sleep(200); // the original delay that was at InformClientOfNeighbourAsync start int count = 0; + IPEndPoint ipe; foreach (GridRegion neighbour in neighbours) { @@ -2165,8 +2166,13 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer { if (newneighbours.Contains(handler)) { - InformClientOfNeighbourAsync(sp, cagents[count], neighbour, - neighbour.ExternalEndPoint, true); + ipe = neighbour.ExternalEndPoint; + if (ipe != null) + InformClientOfNeighbourAsync(sp, cagents[count], neighbour, ipe, true); + else + { + m_log.Debug("[ENTITY TRANSFER MODULE]: DNS for neighbour lost"); + } count++; } else if (!previousRegionNeighbourHandles.Contains(handler))