summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDwayne Boone <dwayne@zeroc.com>2007-05-18 18:53:51 +0000
committerDwayne Boone <dwayne@zeroc.com>2007-05-18 18:53:51 +0000
commit0308d8070ae67a0360a16aab8a6e5ff7c81d651c (patch)
treead4c3f291715041822b206d858ba39e6feac1a52
parentFixed bug 2215 (diff)
downloadice-0308d8070ae67a0360a16aab8a6e5ff7c81d651c.tar.bz2
ice-0308d8070ae67a0360a16aab8a6e5ff7c81d651c.tar.xz
ice-0308d8070ae67a0360a16aab8a6e5ff7c81d651c.zip
Addded check to getHosts if already ip address
-rwxr-xr-xcs/src/Ice/Network.cs22
1 files changed, 16 insertions, 6 deletions
diff --git a/cs/src/Ice/Network.cs b/cs/src/Ice/Network.cs
index 9dd94ee1ae6..e243be837e3 100755
--- a/cs/src/Ice/Network.cs
+++ b/cs/src/Ice/Network.cs
@@ -826,20 +826,30 @@ namespace IceInternal
public static string[] getHosts(string host)
{
- ArrayList hosts;
+ ArrayList hosts = new ArrayList();
int retry = 5;
repeatGetHostByName:
try
{
- IPHostEntry e = Dns.GetHostEntry(host);
- hosts = new ArrayList();
- for(int i = 0; i < e.AddressList.Length; ++i)
+ //
+ // No need for lookup if already ip address.
+ //
+ try
{
- if(e.AddressList[i].AddressFamily != AddressFamily.InterNetworkV6)
+ IPAddress.Parse(host);
+ hosts.Add(host);
+ }
+ catch (FormatException)
+ {
+ IPHostEntry e = Dns.GetHostEntry(host);
+ for(int i = 0; i < e.AddressList.Length; ++i)
{
- hosts.Add(e.AddressList[i].ToString());
+ if(e.AddressList[i].AddressFamily != AddressFamily.InterNetworkV6)
+ {
+ hosts.Add(e.AddressList[i].ToString());
+ }
}
}
}