Paper/patches/server/0319-Fix-CraftServer-isPrimaryThread-and-MinecraftServer-.patch

44 lines
2.3 KiB
Diff
Raw Normal View History

2021-06-11 14:02:28 +02:00
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Spottedleaf <Spottedleaf@users.noreply.github.com>
Date: Mon, 13 May 2019 21:10:59 -0700
Subject: [PATCH] Fix CraftServer#isPrimaryThread and MinecraftServer
isMainThread
md_5 changed it so he could shut down the server asynchronously
from watchdog, although we have patches that prevent that type
of behavior for this exact reason.
md_5 also placed code in PlayerConnectionUtils that would have
solved https://bugs.mojang.com/browse/MC-142590, making the change
to MinecraftServer#isMainThread irrelevant.
By reverting his change to MinecraftServer#isMainThread packet
handling that should have been handled synchronously will be handled
synchronously when the server gets shut down.
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index cdf6394401882cb0702be6ed962e9c0683d3f67a..5ce1fab4d1e68ad83bd46ae6269446b6f913fa07 100644
2021-06-11 14:02:28 +02:00
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -2333,7 +2333,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
2021-06-11 14:02:28 +02:00
// CraftBukkit start
@Override
public boolean isSameThread() {
- return super.isSameThread() || this.isStopped(); // CraftBukkit - MC-142590
+ return super.isSameThread() /*|| this.isStopped()*/; // CraftBukkit - MC-142590 // Paper - causes issues elsewhere
}
public boolean isDebugging() {
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 90cdaebe9b8b81b5f7d65e7b153daec7d0df0411..a98a9a2eb9f19d37bfff412c1dcebecb07b60014 100644
2021-06-11 14:02:28 +02:00
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -2067,7 +2067,7 @@ public final class CraftServer implements Server {
2021-06-11 14:02:28 +02:00
@Override
public boolean isPrimaryThread() {
2021-06-13 13:40:34 +02:00
- return Thread.currentThread().equals(console.serverThread) || this.console.hasStopped() || !org.spigotmc.AsyncCatcher.enabled; // All bets are off if we have shut down (e.g. due to watchdog)
2021-06-11 14:02:28 +02:00
+ return Thread.currentThread().equals(console.serverThread); // Paper - Fix issues with detecting main thread properly
}
// Paper start