From f4efa325bb8a1e4ae876ec5f080cf87c1f8c1de9 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Thu, 31 Dec 2009 11:42:33 -0800 Subject: More progress on both the Simulation service and the Login service. Both still unfinished. --- OpenSim/Framework/Util.cs | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'OpenSim/Framework/Util.cs') diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index 7215086..234021c 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs @@ -1186,6 +1186,33 @@ namespace OpenSim.Framework return null; } + public static OSDMap GetOSDMap(string data) + { + OSDMap args = null; + try + { + OSD buffer; + // We should pay attention to the content-type, but let's assume we know it's Json + buffer = OSDParser.DeserializeJson(data); + if (buffer.Type == OSDType.Map) + { + args = (OSDMap)buffer; + return args; + } + else + { + // uh? + m_log.Debug(("[UTILS]: Got OSD of unexpected type " + buffer.Type.ToString())); + return null; + } + } + catch (Exception ex) + { + m_log.Debug("[UTILS]: exception on GetOSDMap " + ex.Message); + return null; + } + } + public static string[] Glob(string path) { string vol=String.Empty; -- cgit v1.1 From 3112b04c85b9189a9ff1d1c98f8cd23b461a23b9 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sat, 30 Jan 2010 16:18:38 -0800 Subject: Changed an error message to w warning message. --- OpenSim/Framework/Util.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Framework/Util.cs') diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index 234021c..2fc7adc 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs @@ -553,7 +553,7 @@ namespace OpenSim.Framework } catch (Exception e) { - m_log.ErrorFormat("[UTIL]: An error occurred while resolving {0}, {1}", dnsAddress, e); + 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; -- cgit v1.1 From 842b68eeff7571d3c82415c65065bec3c95f34ea Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 18 Feb 2010 04:19:33 +0000 Subject: Change handling of the SYSTEMIP constant to be more sane. This will now choose the first network interface IP address, or the loopback interface if no external interfaces are found. It will log the IP address used as [NETWORK]: Using x.x.x.x for SYSTEMIP. --- OpenSim/Framework/Util.cs | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'OpenSim/Framework/Util.cs') diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index 7215086..48435cb 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs @@ -589,11 +589,17 @@ namespace OpenSim.Framework public static IPAddress GetLocalHost() { - string dnsAddress = "localhost"; + IPAddress[] iplist = GetLocalHosts(); - IPAddress[] hosts = Dns.GetHostEntry(dnsAddress).AddressList; + if (iplist.Length == 0) // No accessible external interfaces + { + IPAddress[] loopback = Dns.GetHostAddresses("localhost"); + IPAddress localhost = loopback[0]; - foreach (IPAddress host in hosts) + return localhost; + } + + foreach (IPAddress host in iplist) { if (!IPAddress.IsLoopback(host) && host.AddressFamily == AddressFamily.InterNetwork) { @@ -601,15 +607,15 @@ namespace OpenSim.Framework } } - if (hosts.Length > 0) + if (iplist.Length > 0) { - foreach (IPAddress host in hosts) + foreach (IPAddress host in iplist) { if (host.AddressFamily == AddressFamily.InterNetwork) return host; } // Well all else failed... - return hosts[0]; + return iplist[0]; } return null; -- cgit v1.1