@@ -60,6 +60,17 @@ public class ServerConnection {
public volatile boolean d;
private final List<ChannelFuture> g = Collections.synchronizedList(Lists.<ChannelFuture>newArrayList());
private final List<NetworkManager> h = Collections.synchronizedList(Lists.<NetworkManager>newArrayList());
+ // Paper start - prevent blocking on adding a new network manager while the server is ticking
+ private final List<NetworkManager> pending = Collections.synchronizedList(Lists.<NetworkManager>newArrayList());
+ private void addPending() {
+ synchronized (pending) {
+ synchronized (this.h) { // Paper // OBFHELPER - List of network managers
+ this.h.addAll(pending);
+ pending.clear();
+ }
+ }
+ }
+ // Paper end
public ServerConnection(MinecraftServer minecraftserver) {
this.f = minecraftserver;
@@ -94,7 +105,7 @@ public class ServerConnection {
channel.pipeline().addLast("timeout", new ReadTimeoutHandler(30)).addLast("legacy_query", new LegacyPingHandler(ServerConnection.this)).addLast("splitter", new PacketSplitter()).addLast("decoder", new PacketDecoder(EnumProtocolDirection.SERVERBOUND)).addLast("prepender", new PacketPrepender()).addLast("encoder", new PacketEncoder(EnumProtocolDirection.CLIENTBOUND));
NetworkManager networkmanager = new NetworkManager(EnumProtocolDirection.SERVERBOUND);