diff options
author | John Hurliman | 2010-02-22 14:10:19 -0800 |
---|---|---|
committer | John Hurliman | 2010-02-22 14:10:19 -0800 |
commit | 71c6559a91a58d93588dcdd8c74b5fce0c1a3780 (patch) | |
tree | cca5b1ea88ad4b29156767afdd77e37ec072c8a7 /OpenSim/Framework/Util.cs | |
parent | * Adds CreatorID to asset metadata. This is just the plumbing to support Crea... (diff) | |
parent | Merge branch 'presence-refactor' of ssh://diva@opensimulator.org/var/git/open... (diff) | |
download | opensim-SC-71c6559a91a58d93588dcdd8c74b5fce0c1a3780.zip opensim-SC-71c6559a91a58d93588dcdd8c74b5fce0c1a3780.tar.gz opensim-SC-71c6559a91a58d93588dcdd8c74b5fce0c1a3780.tar.bz2 opensim-SC-71c6559a91a58d93588dcdd8c74b5fce0c1a3780.tar.xz |
Merge branch 'presence-refactor' of ssh://opensimulator.org/var/git/opensim into presence-refactor
Diffstat (limited to 'OpenSim/Framework/Util.cs')
-rw-r--r-- | OpenSim/Framework/Util.cs | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index 2fc7adc..10af925 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs | |||
@@ -589,11 +589,17 @@ namespace OpenSim.Framework | |||
589 | 589 | ||
590 | public static IPAddress GetLocalHost() | 590 | public static IPAddress GetLocalHost() |
591 | { | 591 | { |
592 | string dnsAddress = "localhost"; | 592 | IPAddress[] iplist = GetLocalHosts(); |
593 | 593 | ||
594 | IPAddress[] hosts = Dns.GetHostEntry(dnsAddress).AddressList; | 594 | if (iplist.Length == 0) // No accessible external interfaces |
595 | { | ||
596 | IPAddress[] loopback = Dns.GetHostAddresses("localhost"); | ||
597 | IPAddress localhost = loopback[0]; | ||
595 | 598 | ||
596 | foreach (IPAddress host in hosts) | 599 | return localhost; |
600 | } | ||
601 | |||
602 | foreach (IPAddress host in iplist) | ||
597 | { | 603 | { |
598 | if (!IPAddress.IsLoopback(host) && host.AddressFamily == AddressFamily.InterNetwork) | 604 | if (!IPAddress.IsLoopback(host) && host.AddressFamily == AddressFamily.InterNetwork) |
599 | { | 605 | { |
@@ -601,15 +607,15 @@ namespace OpenSim.Framework | |||
601 | } | 607 | } |
602 | } | 608 | } |
603 | 609 | ||
604 | if (hosts.Length > 0) | 610 | if (iplist.Length > 0) |
605 | { | 611 | { |
606 | foreach (IPAddress host in hosts) | 612 | foreach (IPAddress host in iplist) |
607 | { | 613 | { |
608 | if (host.AddressFamily == AddressFamily.InterNetwork) | 614 | if (host.AddressFamily == AddressFamily.InterNetwork) |
609 | return host; | 615 | return host; |
610 | } | 616 | } |
611 | // Well all else failed... | 617 | // Well all else failed... |
612 | return hosts[0]; | 618 | return iplist[0]; |
613 | } | 619 | } |
614 | 620 | ||
615 | return null; | 621 | return null; |