Improve SctpMessage.hashCode method

Motivation:

Not all fields of SctpMessage which used to check message equality are used
to generate hashcode.

Modifications:

Use value of 'unordered' field in hashCode method.

Result:

Better hash function of SctpMessage.
This commit is contained in:
Sergey Polovko 2016-01-05 21:21:00 +03:00 committed by Norman Maurer
parent a157528ec2
commit 4eaa59d516

View File

@ -142,6 +142,8 @@ public final class SctpMessage extends DefaultByteBufHolder {
public int hashCode() { public int hashCode() {
int result = streamIdentifier; int result = streamIdentifier;
result = 31 * result + protocolIdentifier; result = 31 * result + protocolIdentifier;
// values 1231 and 1237 are referenced in the javadocs of Boolean#hashCode()
result = 31 * result + (unordered ? 1231 : 1237);
result = 31 * result + content().hashCode(); result = 31 * result + content().hashCode();
return result; return result;
} }