From e6be773522d12ab0b7cba45c3223dfdf88956b3f Mon Sep 17 00:00:00 2001 From: Jason Penilla <11360596+jpenilla@users.noreply.github.com> Date: Thu, 8 Jun 2023 22:25:23 -0700 Subject: [PATCH] Prevent the rcon thread from attempting connections after shutdown --- .../server/Improved-Watchdog-Support.patch | 2 +- ...nnections-shouldn-t-hold-up-shutdown.patch | 23 +++++++++++++++++-- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/patches/server/Improved-Watchdog-Support.patch b/patches/server/Improved-Watchdog-Support.patch index 54db444c01..aaa324468f 100644 --- a/patches/server/Improved-Watchdog-Support.patch +++ b/patches/server/Improved-Watchdog-Support.patch @@ -251,7 +251,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 ((GameRules.BooleanValue) this.getGameRules().getRule(GameRules.RULE_ANNOUNCE_ADVANCEMENTS)).set(dedicatedserverproperties.announcePlayerAchievements, this); } @@ -0,0 +0,0 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface - //this.remoteStatusListener.b(); // Paper - don't wait for remote connections + // this.remoteStatusListener.stop(); // Paper - don't wait for remote connections } - System.exit(0); // CraftBukkit diff --git a/patches/server/Remote-Connections-shouldn-t-hold-up-shutdown.patch b/patches/server/Remote-Connections-shouldn-t-hold-up-shutdown.patch index 2dd2496aba..ca87a1bbe9 100644 --- a/patches/server/Remote-Connections-shouldn-t-hold-up-shutdown.patch +++ b/patches/server/Remote-Connections-shouldn-t-hold-up-shutdown.patch @@ -14,12 +14,31 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (this.rconThread != null) { - this.rconThread.stop(); -+ //this.remoteControlListener.b(); // Paper - don't wait for remote connections ++ this.rconThread.stopNonBlocking(); // Paper - don't wait for remote connections } if (this.queryThreadGs4 != null) { - this.queryThreadGs4.stop(); -+ //this.remoteStatusListener.b(); // Paper - don't wait for remote connections ++ // this.remoteStatusListener.stop(); // Paper - don't wait for remote connections } System.exit(0); // CraftBukkit +diff --git a/src/main/java/net/minecraft/server/rcon/thread/RconThread.java b/src/main/java/net/minecraft/server/rcon/thread/RconThread.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/rcon/thread/RconThread.java ++++ b/src/main/java/net/minecraft/server/rcon/thread/RconThread.java +@@ -0,0 +0,0 @@ public class RconThread extends GenericThread { + + this.clients.clear(); + } ++ // Paper start ++ public void stopNonBlocking() { ++ this.running = false; ++ for (RconClient client : this.clients) { ++ client.running = false; ++ } ++ } ++ // Paper stop + + private void closeSocket(ServerSocket socket) { + LOGGER.debug("closeSocket: {}", (Object)socket);