mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2024-10-06 10:27:26 +02:00
Update time for stored entries, in case time ran backwards.
This commit is contained in:
parent
f9f04feee0
commit
b0dd8b18ed
@ -70,7 +70,12 @@ public class TeleportQueue {
|
|||||||
// Lazy expiration check.
|
// Lazy expiration check.
|
||||||
final Iterator<CountableLocation> it = expectIncoming.iterator();
|
final Iterator<CountableLocation> it = expectIncoming.iterator();
|
||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
if (time - maxAge > it.next().time) {
|
final CountableLocation ref = it.next();
|
||||||
|
if (time < ref.time) {
|
||||||
|
// Time ran backwards. Force keep entries.
|
||||||
|
ref.time = time;
|
||||||
|
}
|
||||||
|
else if (time - maxAge > ref.time) {
|
||||||
it.remove();
|
it.remove();
|
||||||
} else {
|
} else {
|
||||||
break;
|
break;
|
||||||
@ -155,9 +160,14 @@ public class TeleportQueue {
|
|||||||
expectIncoming.removeFirst(); // Do not use the iterator here.
|
expectIncoming.removeFirst(); // Do not use the iterator here.
|
||||||
}
|
}
|
||||||
return AckResolution.ACK;
|
return AckResolution.ACK;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
// Skip until match or none found.
|
// Skip until match or none found.
|
||||||
// TODO: Consider settings like maxSkipCount or strictly return WAITING.
|
// TODO: Consider settings like maxSkipCount or strictly return WAITING.
|
||||||
|
if (packetData.time < ref.time) {
|
||||||
|
// Time ran backwards, update to now.
|
||||||
|
ref.time = packetData.time;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// No match.
|
// No match.
|
||||||
|
Loading…
Reference in New Issue
Block a user