forked from I2P_Developers/i2p.i2p
SSU2: Fix hashcode function to detect dup acks
Arrays.hashCode() interacted badly with it, causing numerous false positives
This commit is contained in:
@ -18,7 +18,7 @@ public class RouterVersion {
|
||||
/** deprecated */
|
||||
public final static String ID = "Git";
|
||||
public final static String VERSION = CoreVersion.VERSION;
|
||||
public final static long BUILD = 12;
|
||||
public final static long BUILD = 13;
|
||||
|
||||
/** for example "-test" */
|
||||
public final static String EXTRA = "";
|
||||
|
@ -525,7 +525,7 @@ public class PeerState2 extends PeerState implements SSU2Payload.PayloadCallback
|
||||
}
|
||||
|
||||
public void gotACK(long ackThru, int acks, byte[] ranges) {
|
||||
int hc = ((int) ackThru) ^ (acks << 24) ^ DataHelper.hashCode(ranges);
|
||||
int hc = (((int) ackThru) << 8) ^ (acks << 24) ^ DataHelper.hashCode(ranges);
|
||||
if (_lastAckHashCode.getAndSet(hc) == hc) {
|
||||
if (_log.shouldDebug())
|
||||
_log.debug("Got dup ACK block: " + SSU2Bitfield.toString(ackThru, acks, ranges, (ranges != null ? ranges.length / 2 : 0)));
|
||||
|
Reference in New Issue
Block a user