diff options
author | Dwayne Boone <dwayne@zeroc.com> | 2005-12-16 14:34:53 +0000 |
---|---|---|
committer | Dwayne Boone <dwayne@zeroc.com> | 2005-12-16 14:34:53 +0000 |
commit | b2baba63fc83c2602fea5bdeb9271a064e9a3f78 (patch) | |
tree | e2baa39d838234b494b156b344bc9ca12718a364 /java/src | |
parent | Fixed bug where new connections would get created when they shouldn't if (diff) | |
download | ice-b2baba63fc83c2602fea5bdeb9271a064e9a3f78.tar.bz2 ice-b2baba63fc83c2602fea5bdeb9271a064e9a3f78.tar.xz ice-b2baba63fc83c2602fea5bdeb9271a064e9a3f78.zip |
Fixed bug wrt hash calculation which did not take into effect hosts can be
different strings (ip or hostname) but still be equivalent.
Diffstat (limited to 'java/src')
-rw-r--r-- | java/src/IceInternal/TcpEndpointI.java | 10 | ||||
-rw-r--r-- | java/src/IceInternal/UdpEndpointI.java | 10 | ||||
-rw-r--r-- | java/src/IceSSL/SslEndpointI.java | 10 |
3 files changed, 27 insertions, 3 deletions
diff --git a/java/src/IceInternal/TcpEndpointI.java b/java/src/IceInternal/TcpEndpointI.java index 1f98d1995e0..cf6f8121c35 100644 --- a/java/src/IceInternal/TcpEndpointI.java +++ b/java/src/IceInternal/TcpEndpointI.java @@ -556,7 +556,15 @@ final class TcpEndpointI extends EndpointI private void calcHashValue() { - _hashCode = _host.hashCode(); + try + { + java.net.InetAddress addr = java.net.InetAddress.getByName(_host); + _hashCode = addr.getHostAddress().hashCode(); + } + catch(java.net.UnknownHostException ex) + { + _hashCode = _host.hashCode(); + } _hashCode = 5 * _hashCode + _port; _hashCode = 5 * _hashCode + _timeout; _hashCode = 5 * _hashCode + _connectionId.hashCode(); diff --git a/java/src/IceInternal/UdpEndpointI.java b/java/src/IceInternal/UdpEndpointI.java index f802747c62a..4babd73eca5 100644 --- a/java/src/IceInternal/UdpEndpointI.java +++ b/java/src/IceInternal/UdpEndpointI.java @@ -740,7 +740,15 @@ final class UdpEndpointI extends EndpointI private void calcHashValue() { - _hashCode = _host.hashCode(); + try + { + java.net.InetAddress addr = java.net.InetAddress.getByName(_host); + _hashCode = addr.getHostAddress().hashCode(); + } + catch(java.net.UnknownHostException ex) + { + _hashCode = _host.hashCode(); + } _hashCode = 5 * _hashCode + _port; _hashCode = 5 * _hashCode + (_connect ? 1 : 0); _hashCode = 5 * _hashCode + _connectionId.hashCode(); diff --git a/java/src/IceSSL/SslEndpointI.java b/java/src/IceSSL/SslEndpointI.java index d843a5b1678..710c6f6d531 100644 --- a/java/src/IceSSL/SslEndpointI.java +++ b/java/src/IceSSL/SslEndpointI.java @@ -556,7 +556,15 @@ final class SslEndpointI extends IceInternal.EndpointI private void calcHashValue() { - _hashCode = _host.hashCode(); + try + { + java.net.InetAddress addr = java.net.InetAddress.getByName(_host); + _hashCode = addr.getHostAddress().hashCode(); + } + catch(java.net.UnknownHostException ex) + { + _hashCode = _host.hashCode(); + } _hashCode = 5 * _hashCode + _port; _hashCode = 5 * _hashCode + _timeout; _hashCode = 5 * _hashCode + _connectionId.hashCode(); |