Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-11-15 20:40:07 +01:00
Fix double lock in ServerConnection
Dieser Commit ist enthalten in:
Ursprung
8c27c1fd27
Commit
ed90e5b3a6
@ -1,4 +1,4 @@
|
||||
From 657ccc96c1093a23903aad6575111bc6fa51bd59 Mon Sep 17 00:00:00 2001
|
||||
From b08b9267a815bb5ed31fc5f94479dd3b54c529a2 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Mon, 16 May 2016 23:19:16 -0400
|
||||
Subject: [PATCH] Avoid blocking on Network Manager creation
|
||||
@ -6,10 +6,10 @@ Subject: [PATCH] Avoid blocking on Network Manager creation
|
||||
Per Paper issue 294
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/ServerConnection.java b/src/main/java/net/minecraft/server/ServerConnection.java
|
||||
index 6a71ebb..5cde4be 100644
|
||||
index 6a71ebb..faf7b60 100644
|
||||
--- a/src/main/java/net/minecraft/server/ServerConnection.java
|
||||
+++ b/src/main/java/net/minecraft/server/ServerConnection.java
|
||||
@@ -60,6 +60,17 @@ public class ServerConnection {
|
||||
@@ -60,6 +60,15 @@ 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());
|
||||
@ -17,17 +17,15 @@ index 6a71ebb..5cde4be 100644
|
||||
+ 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();
|
||||
+ }
|
||||
+ this.h.addAll(pending); // Paper - OBFHELPER - List of network managers
|
||||
+ pending.clear();
|
||||
+ }
|
||||
+ }
|
||||
+ // Paper end
|
||||
|
||||
public ServerConnection(MinecraftServer minecraftserver) {
|
||||
this.f = minecraftserver;
|
||||
@@ -94,7 +105,7 @@ public class ServerConnection {
|
||||
@@ -94,7 +103,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);
|
||||
|
||||
@ -36,7 +34,7 @@ index 6a71ebb..5cde4be 100644
|
||||
channel.pipeline().addLast("packet_handler", networkmanager);
|
||||
networkmanager.setPacketListener(new HandshakeListener(ServerConnection.this.f, networkmanager));
|
||||
}
|
||||
@@ -123,6 +134,7 @@ public class ServerConnection {
|
||||
@@ -123,6 +132,7 @@ public class ServerConnection {
|
||||
|
||||
synchronized (this.h) {
|
||||
// Spigot Start
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren