Paper/Spigot-Server-Patches/0451-Remote-Connections-shouldn-t-hold-up-shutdown.patch
Aikar f37381ea8a
Optimize Network Manager to not need synchronization
Removes synchronization from sending packets
Makes normal packet sends no longer need to be wrapped and queued like it use to work.
Adds more packet queue immunities on top of keep alive to let the following scenarios go out
without delay:
  - Keep Alive
  - Chat
  - Kick
  - All of the packets during the Player Joined World event

Hoping that latter one helps join timeout issues more too for slow connections.

Removes processing packet queue off of main thread
  - for the few cases where it is allowed, order is not necessary nor
    should it even be happening concurrently in first place (handshaking/login/status)

Ensures packets sent asynchronously are dispatched on main thread

This helps ensure safety for ProtocolLib as packet listeners
are commonly accessing world state. This will allow you to schedule
a packet to be sent async, but itll be dispatched sync for packet
listeners to process.

This should solve some deadlock risks

This may provide a decent performance improvement because thread synchronization incurs a cache reset
so by avoiding ever entering a synchronized block, we get to avoid that, and packet sending is a really
hot activity.
2020-05-06 05:28:47 -04:00

29 lines
1.1 KiB
Diff

From 1f66dce82479f635273b51d5ed56cbe4dc287bb9 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Tue, 31 Mar 2020 03:50:42 -0400
Subject: [PATCH] Remote Connections shouldn't hold up shutdown
Bugs in the connection logic appears to leave stale connections even, preventing shutdown
diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java
index 349a0ea213f..1ef7890da59 100644
--- a/src/main/java/net/minecraft/server/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/DedicatedServer.java
@@ -415,11 +415,11 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
}
if (this.remoteControlListener != null) {
- this.remoteControlListener.b();
+ //this.remoteControlListener.b(); // Paper - don't wait for remote connections
}
if (this.remoteStatusListener != null) {
- this.remoteStatusListener.b();
+ //this.remoteStatusListener.b(); // Paper - don't wait for remote connections
}
System.exit(0); // CraftBukkit
--
2.26.2