From df292ced7a81424802772457feffa72b049b1a70 Mon Sep 17 00:00:00 2001 From: Jake Potrebic Date: Fri, 10 May 2024 17:23:58 -0700 Subject: [PATCH] Fix keepalive time interval (#10690) --- patches/server/Add-PlayerKickEvent-causes.patch | 4 ++-- patches/server/revert-serverside-behavior-of-keepalives.patch | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/patches/server/Add-PlayerKickEvent-causes.patch b/patches/server/Add-PlayerKickEvent-causes.patch index 252ff48618..7ffdd703d7 100644 --- a/patches/server/Add-PlayerKickEvent-causes.patch +++ b/patches/server/Add-PlayerKickEvent-causes.patch @@ -154,8 +154,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 protected void keepConnectionAlive() { @@ -0,0 +0,0 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack - if (!this.isSingleplayerOwner() && elapsedTime >= KEEPALIVE_LIMIT) { // Paper - check keepalive limit, don't fire if already disconnected - if (this.keepAlivePending && !this.processedDisconnect) { // Paper + if (!this.isSingleplayerOwner() && elapsedTime >= 15000L) { // Paper - use vanilla's 15000L between keep alive packets + if (this.keepAlivePending && !this.processedDisconnect && elapsedTime >= KEEPALIVE_LIMIT) { // Paper - check keepalive limit, don't fire if already disconnected - this.disconnect(ServerCommonPacketListenerImpl.TIMEOUT_DISCONNECTION_MESSAGE); + this.disconnect(ServerCommonPacketListenerImpl.TIMEOUT_DISCONNECTION_MESSAGE, org.bukkit.event.player.PlayerKickEvent.Cause.TIMEOUT); // Paper - kick event cause } else if (this.checkIfClosed(currentTime)) { // Paper diff --git a/patches/server/revert-serverside-behavior-of-keepalives.patch b/patches/server/revert-serverside-behavior-of-keepalives.patch index 7ef3c2d0a5..716f9a421b 100644 --- a/patches/server/revert-serverside-behavior-of-keepalives.patch +++ b/patches/server/revert-serverside-behavior-of-keepalives.patch @@ -49,8 +49,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - if (!this.isSingleplayerOwner() && i - this.keepAliveTime >= 25000L) { // CraftBukkit - if (this.keepAlivePending) { -+ if (!this.isSingleplayerOwner() && elapsedTime >= KEEPALIVE_LIMIT) { // Paper - check keepalive limit, don't fire if already disconnected -+ if (this.keepAlivePending && !this.processedDisconnect) { // Paper ++ if (!this.isSingleplayerOwner() && elapsedTime >= 15000L) { // Paper - use vanilla's 15000L between keep alive packets ++ if (this.keepAlivePending && !this.processedDisconnect && elapsedTime >= KEEPALIVE_LIMIT) { // Paper - check keepalive limit, don't fire if already disconnected this.disconnect(ServerCommonPacketListenerImpl.TIMEOUT_DISCONNECTION_MESSAGE); - } else if (this.checkIfClosed(i)) { + } else if (this.checkIfClosed(currentTime)) { // Paper