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 ea9fdc393c
commit 9ada4bd7af
No known key found for this signature in database
GPG Key ID: 0E75A301420E48F8
2 changed files with 24 additions and 5 deletions

View File

@ -6,7 +6,7 @@ Subject: [PATCH] Remote Connections shouldn't hold up shutdown
Bugs in the connection logic appears to leave stale connections even, preventing shutdown Bugs in the connection logic appears to leave stale connections even, preventing shutdown
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
index c2f5d3153591d48c6c2afdec049a7b390066bfdb..f4c7866a27319b2da8c00e8fe9b8f1f6306045ab 100644 index c2f5d3153591d48c6c2afdec049a7b390066bfdb..aa1622fb3ea1f349b539e09c811de0f297a86076 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java --- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java +++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
@@ -391,11 +391,11 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface @@ -391,11 +391,11 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
@ -14,12 +14,31 @@ index c2f5d3153591d48c6c2afdec049a7b390066bfdb..f4c7866a27319b2da8c00e8fe9b8f1f6
if (this.rconThread != null) { if (this.rconThread != null) {
- this.rconThread.stop(); - 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) { if (this.queryThreadGs4 != null) {
- this.queryThreadGs4.stop(); - 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 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 3bf60f640aa9fa4cabd2b3e5d3931e8467b9df24..2c1289aa2bf8b7bb67709190263b82b811c17fff 100644
--- a/src/main/java/net/minecraft/server/rcon/thread/RconThread.java
+++ b/src/main/java/net/minecraft/server/rcon/thread/RconThread.java
@@ -107,6 +107,14 @@ 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);

View File

@ -238,7 +238,7 @@ index b2b7f5f30b3967a9f8a32e27557639da7d408152..8fc669ec3b6afa4ed9447878604ba2b2
this.functionManager.replaceLibrary(this.resources.managers.getFunctionLibrary()); this.functionManager.replaceLibrary(this.resources.managers.getFunctionLibrary());
this.structureTemplateManager.onResourceManagerReload(this.resources.resourceManager); this.structureTemplateManager.onResourceManagerReload(this.resources.resourceManager);
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
index f4c7866a27319b2da8c00e8fe9b8f1f6306045ab..71b395db734c257a64ec3297eebbe52883ea4cc7 100644 index aa1622fb3ea1f349b539e09c811de0f297a86076..aaad6b0de19872c6e54591adf90c30d2c2ed5223 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java --- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java +++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
@@ -269,7 +269,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface @@ -269,7 +269,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
@ -251,7 +251,7 @@ index f4c7866a27319b2da8c00e8fe9b8f1f6306045ab..71b395db734c257a64ec3297eebbe528
((GameRules.BooleanValue) this.getGameRules().getRule(GameRules.RULE_ANNOUNCE_ADVANCEMENTS)).set(dedicatedserverproperties.announcePlayerAchievements, this); ((GameRules.BooleanValue) this.getGameRules().getRule(GameRules.RULE_ANNOUNCE_ADVANCEMENTS)).set(dedicatedserverproperties.announcePlayerAchievements, this);
} }
@@ -398,7 +398,8 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface @@ -398,7 +398,8 @@ 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 - System.exit(0); // CraftBukkit