diff options
Diffstat (limited to 'OpenSim/Framework/General/Util.cs')
-rw-r--r-- | OpenSim/Framework/General/Util.cs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/OpenSim/Framework/General/Util.cs b/OpenSim/Framework/General/Util.cs index a263d7e..fe4ce29 100644 --- a/OpenSim/Framework/General/Util.cs +++ b/OpenSim/Framework/General/Util.cs | |||
@@ -249,6 +249,13 @@ namespace OpenSim.Framework.Utilities | |||
249 | /// <returns>An IP address, or null</returns> | 249 | /// <returns>An IP address, or null</returns> |
250 | public static IPAddress GetHostFromDNS(string dnsAddress) | 250 | public static IPAddress GetHostFromDNS(string dnsAddress) |
251 | { | 251 | { |
252 | |||
253 | // Is it already a valid IP? No need to look it up. | ||
254 | IPAddress ipa; | ||
255 | if (IPAddress.TryParse(dnsAddress, out ipa)) | ||
256 | return ipa; | ||
257 | |||
258 | // Not an IP, lookup required | ||
252 | IPAddress[] hosts = Dns.GetHostEntry(dnsAddress).AddressList; | 259 | IPAddress[] hosts = Dns.GetHostEntry(dnsAddress).AddressList; |
253 | 260 | ||
254 | foreach (IPAddress host in hosts) | 261 | foreach (IPAddress host in hosts) |