summaryrefslogtreecommitdiff
path: root/java/src/IceInternal/TcpEndpointI.java
diff options
context:
space:
mode:
authorJose <jose@zeroc.com>2012-08-10 19:05:05 +0200
committerJose <jose@zeroc.com>2012-08-10 19:05:05 +0200
commitdac1de9cee466c49bb66d1fa3ff3e7f8ce74b41d (patch)
treee21599db79868ffc65be32b4dda2056af9e18b0b /java/src/IceInternal/TcpEndpointI.java
parentRemove some more VC6 compiler fixes (diff)
downloadice-dac1de9cee466c49bb66d1fa3ff3e7f8ce74b41d.tar.bz2
ice-dac1de9cee466c49bb66d1fa3ff3e7f8ce74b41d.tar.xz
ice-dac1de9cee466c49bb66d1fa3ff3e7f8ce74b41d.zip
ICE-4702 - Poor hash algorithm
Diffstat (limited to 'java/src/IceInternal/TcpEndpointI.java')
-rw-r--r--java/src/IceInternal/TcpEndpointI.java17
1 files changed, 10 insertions, 7 deletions
diff --git a/java/src/IceInternal/TcpEndpointI.java b/java/src/IceInternal/TcpEndpointI.java
index 0d2ab229193..18426c4494d 100644
--- a/java/src/IceInternal/TcpEndpointI.java
+++ b/java/src/IceInternal/TcpEndpointI.java
@@ -556,13 +556,16 @@ final class TcpEndpointI extends EndpointI
private void
calcHashValue()
{
- _hashCode = _host.hashCode();
- _hashCode = 5 * _hashCode + _port;
- _hashCode = 5 * _hashCode + _timeout;
- _hashCode = 5 * _hashCode + _protocol.hashCode();
- _hashCode = 5 * _hashCode + _encoding.hashCode();
- _hashCode = 5 * _hashCode + _connectionId.hashCode();
- _hashCode = 5 * _hashCode + (_compress ? 1 : 0);
+ int h = 5381;
+ h = IceInternal.HashUtil.hashAdd(h, Ice.TCPEndpointType.value);
+ h = IceInternal.HashUtil.hashAdd(h, _host);
+ h = IceInternal.HashUtil.hashAdd(h, _port);
+ h = IceInternal.HashUtil.hashAdd(h, _timeout);
+ h = IceInternal.HashUtil.hashAdd(h, _protocol);
+ h = IceInternal.HashUtil.hashAdd(h, _encoding);
+ h = IceInternal.HashUtil.hashAdd(h, _connectionId);
+ h = IceInternal.HashUtil.hashAdd(h, _compress);
+ _hashCode = h;
}
private Instance _instance;