mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2024-09-15 08:28:10 +02:00
Only check for lag if there is windows to burn.
This commit is contained in:
parent
1441859ced
commit
7de214abae
@ -38,6 +38,7 @@ public class NetStatic {
|
|||||||
final int winNum = packetFreq.numberOfBuckets();
|
final int winNum = packetFreq.numberOfBuckets();
|
||||||
// Add packet to frequency count.
|
// Add packet to frequency count.
|
||||||
packetFreq.add(time, packets);
|
packetFreq.add(time, packets);
|
||||||
|
// TODO: Add a per-bucket violation AF (once first bucket > thresh => pbvAF.add(now, 1f) + if total score > xyz => extra violation).
|
||||||
|
|
||||||
// Fill up all "used" time windows (minimum we can do without other events).
|
// Fill up all "used" time windows (minimum we can do without other events).
|
||||||
final float burnScore = (float) idealPackets * (float) winDur / 1000f;
|
final float burnScore = (float) idealPackets * (float) winDur / 1000f;
|
||||||
@ -47,6 +48,7 @@ public class NetStatic {
|
|||||||
boolean used = false;
|
boolean used = false;
|
||||||
for (burnStart = 1; burnStart < winNum; burnStart ++) {
|
for (burnStart = 1; burnStart < winNum; burnStart ++) {
|
||||||
if (packetFreq.bucketScore(burnStart) > 0f) {
|
if (packetFreq.bucketScore(burnStart) > 0f) {
|
||||||
|
// TODO: burnStart ++; Fill up all ? ~ e.g. what with filled up half?
|
||||||
if (used) {
|
if (used) {
|
||||||
for (int j = burnStart; j < winNum; j ++) {
|
for (int j = burnStart; j < winNum; j ++) {
|
||||||
if (packetFreq.bucketScore(j) == 0f) {
|
if (packetFreq.bucketScore(j) == 0f) {
|
||||||
@ -63,14 +65,17 @@ public class NetStatic {
|
|||||||
// TODO: Burn time windows based on other activity counting [e.g. same resolution ActinFrequency with keep-alive].
|
// TODO: Burn time windows based on other activity counting [e.g. same resolution ActinFrequency with keep-alive].
|
||||||
|
|
||||||
// Adjust empty based on server side lag, this makes the check more strict.
|
// Adjust empty based on server side lag, this makes the check more strict.
|
||||||
// TODO: Consider to add a config flag for skipping the lag adaption (e.g. strict).
|
if (empty > 0) {
|
||||||
final float lag = TickTask.getLag(winDur * winNum, true);
|
// TODO: Consider to add a config flag for skipping the lag adaption (e.g. strict).
|
||||||
// TODO: Consider increasing the allowed maximum, for extreme server-side lag.
|
final float lag = TickTask.getLag(winDur * winNum, true);
|
||||||
empty = Math.min(empty, (int) Math.round((lag - 1f) * winNum));
|
// TODO: Consider increasing the allowed maximum, for extreme server-side lag.
|
||||||
|
empty = Math.min(empty, (int) Math.round((lag - 1f) * winNum));
|
||||||
|
}
|
||||||
|
|
||||||
final double fullCount;
|
final double fullCount;
|
||||||
if (burnStart < winNum) {
|
if (burnStart < winNum) {
|
||||||
// Assume all following time windows are burnt.
|
// Assume all following time windows are burnt.
|
||||||
|
// TODO: empty score + trailing score !? max with trailing bukkets * ideal (!)
|
||||||
final float trailing = Math.max(packetFreq.trailingScore(burnStart, 1f), burnScore * (winNum - burnStart - empty));
|
final float trailing = Math.max(packetFreq.trailingScore(burnStart, 1f), burnScore * (winNum - burnStart - empty));
|
||||||
final float leading = packetFreq.leadingScore(burnStart, 1f);
|
final float leading = packetFreq.leadingScore(burnStart, 1f);
|
||||||
fullCount = leading + trailing;
|
fullCount = leading + trailing;
|
||||||
|
Loading…
Reference in New Issue
Block a user