Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix MinecraftServer#isMainThread (#2046)
See patch notes
- Loading branch information
1 parent
37431d2
commit 2e18e54
Showing
2 changed files
with
46 additions
and
25 deletions.
There are no files selected for viewing
46 changes: 46 additions & 0 deletions
46
Spigot-Server-Patches/0392-Fix-CraftServer-isPrimaryThread-and-MinecraftServer-.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
From 32cdfb9500efe574a54465daca2204f8fe78d4a2 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 70f730996c..73ac45bf7a 100644 | ||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java | ||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java | ||
@@ -1945,7 +1945,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas | ||
// CraftBukkit start | ||
@Override | ||
public boolean isMainThread() { | ||
- return super.isMainThread() || this.isStopped(); // CraftBukkit - MC-142590 | ||
+ return super.isMainThread() /*|| this.isStopped()*/; // CraftBukkit - MC-142590 // Paper - causes issues elsewhere | ||
} | ||
|
||
@Deprecated | ||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java | ||
index 56e8a613e9..22d53844c5 100644 | ||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java | ||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java | ||
@@ -1663,7 +1663,7 @@ public final class CraftServer implements Server { | ||
|
||
@Override | ||
public boolean isPrimaryThread() { | ||
- return Thread.currentThread().equals(console.serverThread) || console.hasStopped() || !org.spigotmc.AsyncCatcher.enabled; // All bets are off if we have shut down (e.g. due to watchdog) | ||
+ return Thread.currentThread().equals(console.serverThread); // Paper - Fix issues with detecting main thread properly | ||
} | ||
|
||
@Override | ||
-- | ||
2.21.0 | ||
|
25 changes: 0 additions & 25 deletions
25
Spigot-Server-Patches/0392-Fix-CraftServer-isPrimaryThread.patch
This file was deleted.
Oops, something went wrong.