diff options
author | Jose <jose@zeroc.com> | 2012-08-10 19:05:05 +0200 |
---|---|---|
committer | Jose <jose@zeroc.com> | 2012-08-10 19:05:05 +0200 |
commit | dac1de9cee466c49bb66d1fa3ff3e7f8ce74b41d (patch) | |
tree | e21599db79868ffc65be32b4dda2056af9e18b0b /java/src/IceInternal/TcpEndpointI.java | |
parent | Remove some more VC6 compiler fixes (diff) | |
download | ice-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.java | 17 |
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; |