some cleanup and assume Linux/mono DNS is just broken...
parent
7be6e16555
commit
8f86de265c
|
@ -1009,6 +1009,9 @@ namespace OpenSim.Framework
|
|||
public static IPAddress GetHostFromDNS(string dnsAddress)
|
||||
{
|
||||
// If it is already an IP, avoid possible broken mono from seeing it
|
||||
if(String.IsNullOrWhiteSpace(dnsAddress))
|
||||
return null;
|
||||
|
||||
IPAddress ia = null;
|
||||
if (IPAddress.TryParse(dnsAddress, out ia) && ia != null)
|
||||
{
|
||||
|
@ -1016,11 +1019,22 @@ namespace OpenSim.Framework
|
|||
return null;
|
||||
return ia;
|
||||
}
|
||||
// Reset for next check
|
||||
ia = null;
|
||||
|
||||
IPHostEntry IPH;
|
||||
try
|
||||
{
|
||||
foreach (IPAddress Adr in Dns.GetHostAddresses(dnsAddress))
|
||||
IPH = Dns.GetHostEntry(dnsAddress);
|
||||
}
|
||||
catch // (SocketException e)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if(IPH == null || IPH.AddressList.Length == 0)
|
||||
return null;
|
||||
|
||||
ia = null;
|
||||
foreach (IPAddress Adr in IPH.AddressList)
|
||||
{
|
||||
if (ia == null)
|
||||
ia = Adr;
|
||||
|
@ -1031,17 +1045,6 @@ namespace OpenSim.Framework
|
|||
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;
|
||||
}
|
||||
|
||||
|
@ -1076,11 +1079,21 @@ namespace OpenSim.Framework
|
|||
return getEndPoint(ia, port);
|
||||
}
|
||||
|
||||
// Reset for next check
|
||||
ia = null;
|
||||
IPHostEntry IPH;
|
||||
try
|
||||
{
|
||||
foreach (IPAddress Adr in Dns.GetHostAddresses(hostname))
|
||||
IPH = Dns.GetHostEntry(hostname);
|
||||
}
|
||||
catch // (SocketException e)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if(IPH == null || IPH.AddressList.Length == 0)
|
||||
return null;
|
||||
|
||||
ia = null;
|
||||
foreach (IPAddress Adr in IPH.AddressList)
|
||||
{
|
||||
if (ia == null)
|
||||
ia = Adr;
|
||||
|
@ -1091,11 +1104,6 @@ namespace OpenSim.Framework
|
|||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch // (SocketException e)
|
||||
{
|
||||
ia = null;
|
||||
}
|
||||
|
||||
return getEndPoint(ia,port);
|
||||
}
|
||||
|
|
|
@ -157,7 +157,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
m_idCache = new ExpiringCache<ulong, DateTime>();
|
||||
m_bannedRegions.Add(pAgentID, m_idCache, TimeSpan.FromSeconds(newTime));
|
||||
}
|
||||
m_idCache.Add(pRegionHandle, DateTime.UtcNow + TimeSpan.FromSeconds(extendTime), TimeSpan.FromSeconds(extendTime));
|
||||
m_idCache.Add(pRegionHandle, DateTime.UtcNow + TimeSpan.FromSeconds(extendTime), extendTime);
|
||||
}
|
||||
|
||||
// Remove the agent from the region's banned list
|
||||
|
@ -1488,13 +1488,11 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
Math.Max(scene.RegionInfo.RegionSizeX, scene.RegionInfo.RegionSizeY));
|
||||
|
||||
if (neighbourRegion == null)
|
||||
{
|
||||
failureReason = "no region found"; // debug -> to remove
|
||||
return null;
|
||||
}
|
||||
|
||||
if (m_bannedRegionCache.IfBanned(neighbourRegion.RegionHandle, agentID))
|
||||
{
|
||||
failureReason = "Access Denied";
|
||||
failureReason = "Access Denied or Temporary not possible";
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -1513,6 +1511,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
{
|
||||
// remember the fail
|
||||
m_bannedRegionCache.Add(neighbourRegion.RegionHandle, agentID);
|
||||
if(String.IsNullOrWhiteSpace(failureReason))
|
||||
failureReason = "Access Denied";
|
||||
return null;
|
||||
}
|
||||
|
@ -2171,7 +2170,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
InformClientOfNeighbourAsync(sp, cagents[count], neighbour, ipe, true);
|
||||
else
|
||||
{
|
||||
m_log.DebugFormat("[ENTITY TRANSFER MODULE]: DNS for neighbour {0} lost", neighbour.ExternalHostName);
|
||||
m_log.DebugFormat("[ENTITY TRANSFER MODULE]: lost DNS resolution for neighbour {0}", neighbour.ExternalHostName);
|
||||
}
|
||||
count++;
|
||||
}
|
||||
|
|
|
@ -70,10 +70,15 @@ namespace OpenSim.Services.Connectors.Hypergrid
|
|||
{
|
||||
Uri m_Uri = new Uri(m_ServerURL);
|
||||
IPAddress ip = Util.GetHostFromDNS(m_Uri.Host);
|
||||
if(ip != null)
|
||||
{
|
||||
m_ServerURL = m_ServerURL.Replace(m_Uri.Host, ip.ToString());
|
||||
if (!m_ServerURL.EndsWith("/"))
|
||||
m_ServerURL += "/";
|
||||
}
|
||||
else
|
||||
m_log.DebugFormat("[USER AGENT CONNECTOR]: Failed to resolv address of {0}", url);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.DebugFormat("[USER AGENT CONNECTOR]: Malformed Uri {0}: {1}", url, e.Message);
|
||||
|
|
Loading…
Reference in New Issue