From 7af31d294224bbfe91d97bf0b8e54a60647092c3 Mon Sep 17 00:00:00 2001 From: md_5 Date: Sun, 27 Apr 2014 10:52:18 +1000 Subject: [PATCH] Revert "Merge pull request #155 from yawkat/killed-connections-fix" This reverts commit ce42d88219cd85494406b6ebafb6673a39c66415, reversing changes made to c3eeab45cd959f9abf735998a091a58dd662fe8b. --- ...on-that-could-kill-connections-befor.patch | 63 ------------------- 1 file changed, 63 deletions(-) delete mode 100644 CraftBukkit-Patches/0141-Fix-race-condition-that-could-kill-connections-befor.patch diff --git a/CraftBukkit-Patches/0141-Fix-race-condition-that-could-kill-connections-befor.patch b/CraftBukkit-Patches/0141-Fix-race-condition-that-could-kill-connections-befor.patch deleted file mode 100644 index 65e584a6d..000000000 --- a/CraftBukkit-Patches/0141-Fix-race-condition-that-could-kill-connections-befor.patch +++ /dev/null @@ -1,63 +0,0 @@ -From 91faf0e210d3dd7664e66dc46aaace12190e5727 Mon Sep 17 00:00:00 2001 -From: Jonas Konrad -Date: Fri, 25 Apr 2014 23:46:46 +0200 -Subject: [PATCH] Fix race condition that could kill connections before they - were initiated - -Because NetworkManagers are registered before they get their channel in -channelActive, the ServerConnection would remove them sometimes because -it thought they were disconnected. This commit fixes this by introducing -a 'preparing' variable that is true while the NetworkManager is not -initialized. The ServerConnection does not remove NetworkManagers with -this flag. - -diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/java/net/minecraft/server/NetworkManager.java -index d1b9c49..e9973c2 100644 ---- a/src/main/java/net/minecraft/server/NetworkManager.java -+++ b/src/main/java/net/minecraft/server/NetworkManager.java -@@ -42,6 +42,7 @@ public class NetworkManager extends SimpleChannelInboundHandler { - public SocketAddress n; - public java.util.UUID spoofedUUID; - public Property[] spoofedProfile; -+ public boolean preparing = true; - // Spigot End - private PacketListener o; - private EnumProtocol p; -@@ -69,6 +70,9 @@ public class NetworkManager extends SimpleChannelInboundHandler { - super.channelActive(channelhandlercontext); - this.m = channelhandlercontext.channel(); - this.n = this.m.remoteAddress(); -+ // Spigot Start -+ this.preparing = false; -+ // Spigot End - this.a(EnumProtocol.HANDSHAKING); - } - -@@ -187,6 +191,9 @@ public class NetworkManager extends SimpleChannelInboundHandler { - } - - public void close(IChatBaseComponent ichatbasecomponent) { -+ // Spigot Start -+ this.preparing = false; -+ // Spigot End - if (this.m.isOpen()) { - this.m.close(); - this.q = ichatbasecomponent; -diff --git a/src/main/java/net/minecraft/server/ServerConnection.java b/src/main/java/net/minecraft/server/ServerConnection.java -index 1d7b814..981e22c 100644 ---- a/src/main/java/net/minecraft/server/ServerConnection.java -+++ b/src/main/java/net/minecraft/server/ServerConnection.java -@@ -66,6 +66,10 @@ public class ServerConnection { - NetworkManager networkmanager = (NetworkManager) iterator.next(); - - if (!networkmanager.isConnected()) { -+ // Spigot Start -+ // Fix a race condition where a NetworkManager could be unregistered just before connection. -+ if (networkmanager.preparing) continue; -+ // Spigot End - iterator.remove(); - if (networkmanager.f() != null) { - networkmanager.getPacketListener().a(networkmanager.f()); --- -1.8.3.2 -