SSU2: Fix hashcode function to detect dup acks

Arrays.hashCode() interacted badly with it,
causing numerous false positives
This commit is contained in:
zzz
2022-04-05 14:13:23 -04:00
parent cc85df19aa
commit 0449589406
2 changed files with 2 additions and 2 deletions

View File

@ -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 = "";

View File

@ -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)));