Fix handling of roll-over-counter. Sequence numbers are unsigned short, thus

store them as unsigned short (mask with 0xffff). Add missing code to handle
replay checks.
cusax-fix
Werner Dittmann 17 years ago
parent 32a982afdc
commit 156bd06763

@ -561,7 +561,7 @@ boolean checkReplay(int seqNum)
}
long guessedIndex = guessIndex( seqNum );
long localIndex = (((long)this.roc) << 16 & 0xFFFF) | this.seqNum;
long localIndex = ((long)this.roc) << 16 | this.seqNum;
long delta = guessedIndex - localIndex;
if (delta > 0)
@ -751,16 +751,25 @@ private long guessIndex(int seqNum)
*/
private void update(int seqNum)
{
guessIndex(seqNum);
long delta = guessIndex(seqNum) - (((long) this.roc) << 16 | this.seqNum);
/* update the replay bit mask */
if( delta > 0 ){
replayWindow = replayWindow << delta;
replayWindow |= 1;
}
else {
replayWindow |= ( 1 << delta );
}
if (seqNum > this.seqNum)
{
this.seqNum = seqNum;
this.seqNum = seqNum & 0xffff; // make short
}
if (this.guessedROC > this.roc)
{
this.roc = this.guessedROC;
this.seqNum = seqNum;
this.seqNum = seqNum & 0xffff; // make short
}
}

Loading…
Cancel
Save