mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-27 15:00:13 +01:00
Fix keepalive logic resetting counter
This would of actually arised in the client being kicked due to sending bad keepalive packets due to the erronious extra sending of keepalives too
This commit is contained in:
parent
3331805d0b
commit
c9a904ed17
1 changed files with 6 additions and 5 deletions
|
@ -95,7 +95,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
@@ -88,30 +_,117 @@
|
||||
@@ -88,30 +_,119 @@
|
||||
public void handlePong(ServerboundPongPacket packet) {
|
||||
}
|
||||
|
||||
|
@ -208,15 +208,16 @@
|
|||
Profiler.get().push("keepAlive");
|
||||
long millis = Util.getMillis();
|
||||
- if (!this.isSingleplayerOwner() && millis - this.keepAliveTime >= 15000L) {
|
||||
- if (this.keepAlivePending) {
|
||||
- this.disconnect(TIMEOUT_DISCONNECTION_MESSAGE);
|
||||
+ // Paper start - give clients a longer time to respond to pings as per pre 1.12.2 timings
|
||||
+ // This should effectively place the keepalive handling back to "as it was" before 1.12.2
|
||||
+ final long elapsedTime = millis - this.keepAliveTime;
|
||||
+ if (!this.isSingleplayerOwner() && elapsedTime >= 15000L) { // use vanilla's 15000L between keep alive packets
|
||||
+ if (this.keepAlivePending && !this.processedDisconnect && elapsedTime >= KEEPALIVE_LIMIT) { // check keepalive limit, don't fire if already disconnected
|
||||
if (this.keepAlivePending) {
|
||||
- this.disconnect(TIMEOUT_DISCONNECTION_MESSAGE);
|
||||
+ if (!this.processedDisconnect && elapsedTime >= KEEPALIVE_LIMIT) { // check keepalive limit, don't fire if already disconnected
|
||||
+ this.disconnect(TIMEOUT_DISCONNECTION_MESSAGE, org.bukkit.event.player.PlayerKickEvent.Cause.TIMEOUT); // Paper - kick event cause
|
||||
+ }
|
||||
+ // Paper end - give clients a longer time to respond to pings as per pre 1.12.2 timings
|
||||
+ this.disconnect(TIMEOUT_DISCONNECTION_MESSAGE, org.bukkit.event.player.PlayerKickEvent.Cause.TIMEOUT); // Paper - kick event cause
|
||||
} else if (this.checkIfClosed(millis)) {
|
||||
this.keepAlivePending = true;
|
||||
this.keepAliveTime = millis;
|
||||
|
|
Loading…
Reference in a new issue