cleanup (grid)region info endpoint; add log to try to find some xml decode issues
parent
8f10db0a6a
commit
e7c2674dec
|
@ -420,6 +420,7 @@ namespace OpenSim.Framework
|
|||
set { m_remotingPort = value; }
|
||||
}
|
||||
|
||||
|
||||
/// <value>
|
||||
/// This accessor can throw all the exceptions that Dns.GetHostAddresses can throw.
|
||||
///
|
||||
|
@ -427,42 +428,7 @@ namespace OpenSim.Framework
|
|||
/// </value>
|
||||
public IPEndPoint ExternalEndPoint
|
||||
{
|
||||
get
|
||||
{
|
||||
// Old one defaults to IPv6
|
||||
//return new IPEndPoint(Dns.GetHostAddresses(m_externalHostName)[0], m_internalEndPoint.Port);
|
||||
|
||||
IPAddress ia = null;
|
||||
// If it is already an IP, don't resolve it - just return directly
|
||||
if (IPAddress.TryParse(m_externalHostName, out ia))
|
||||
return new IPEndPoint(ia, m_internalEndPoint.Port);
|
||||
|
||||
// Reset for next check
|
||||
ia = null;
|
||||
try
|
||||
{
|
||||
foreach (IPAddress Adr in Dns.GetHostAddresses(m_externalHostName))
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
return new IPEndPoint(ia, m_internalEndPoint.Port);
|
||||
}
|
||||
|
||||
get { return Util.getEndPoint(m_externalHostName, m_internalEndPoint.Port); }
|
||||
set { m_externalHostName = value.ToString(); }
|
||||
}
|
||||
|
||||
|
|
|
@ -429,6 +429,65 @@ 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)
|
||||
{
|
||||
serviceURI = string.Empty;
|
||||
|
|
|
@ -478,17 +478,22 @@ namespace OpenSim.Server.Base
|
|||
|
||||
XmlDocument doc = new XmlDocument();
|
||||
|
||||
doc.LoadXml(data);
|
||||
try
|
||||
{
|
||||
doc.LoadXml(data);
|
||||
XmlNodeList rootL = doc.GetElementsByTagName("ServerResponse");
|
||||
|
||||
XmlNodeList rootL = doc.GetElementsByTagName("ServerResponse");
|
||||
if (rootL.Count != 1)
|
||||
return ret;
|
||||
|
||||
if (rootL.Count != 1)
|
||||
return ret;
|
||||
|
||||
XmlNode rootNode = rootL[0];
|
||||
|
||||
ret = ParseElement(rootNode);
|
||||
XmlNode rootNode = rootL[0];
|
||||
|
||||
ret = ParseElement(rootNode);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.DebugFormat("[serverUtils.ParseXmlResponse]: failed error: {0} \n --- string: {1} - ",e.Message, data);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
@ -462,50 +462,7 @@ namespace OpenSim.Services.Interfaces
|
|||
/// </value>
|
||||
public IPEndPoint ExternalEndPoint
|
||||
{
|
||||
get
|
||||
{
|
||||
IPAddress ia = null;
|
||||
// If it is already an IP, don't resolve it - just return directly
|
||||
// we should not need this
|
||||
if (IPAddress.TryParse(m_externalHostName, out ia))
|
||||
{
|
||||
if (ia.Equals(IPAddress.Any) || ia.Equals(IPAddress.IPv6Any))
|
||||
return null;
|
||||
return new IPEndPoint(ia, m_internalEndPoint.Port);
|
||||
}
|
||||
|
||||
// Reset for next check
|
||||
ia = null;
|
||||
try
|
||||
{
|
||||
foreach (IPAddress Adr in Dns.GetHostAddresses(m_externalHostName))
|
||||
{
|
||||
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(ia == null)
|
||||
return null;
|
||||
|
||||
return new IPEndPoint(ia, m_internalEndPoint.Port);
|
||||
}
|
||||
get { return Util.getEndPoint(m_externalHostName, m_internalEndPoint.Port); }
|
||||
}
|
||||
|
||||
public string ExternalHostName
|
||||
|
|
Loading…
Reference in New Issue