Prevent the rcon thread from attempting connections after shutdown

This commit is contained in:
Jason Penilla 2023-06-08 22:25:23 -07:00
parent b3a92319b9
commit e6be773522
2 changed files with 22 additions and 3 deletions

View file

@ -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

View file

@ -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);