mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-18 08:36:13 +01:00
cab333b217
Don't send requests of every player was found in the global api cache SpigotMC/Spigot@841270ff1e Correctly set the response code for the cached lookups and return the ... SpigotMC/Spigot@f170b7899c Don't try and re-set the global api cache on reload SpigotMC/Spigot@b410a00a66 Use a compile time sneaky throw hack. SpigotMC/Spigot@508462b96b Fix a missed rename in WorldGenGroundBush SpigotMC/Spigot@0614d8fae9
64 lines
2.7 KiB
Diff
64 lines
2.7 KiB
Diff
From ee1c3f527f82e3988082a725c9f1705be9fa36af Mon Sep 17 00:00:00 2001
|
|
From: Jonas Konrad <me@yawk.at>
|
|
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 9939652..ae3de2f 100644
|
|
--- a/src/main/java/net/minecraft/server/NetworkManager.java
|
|
+++ b/src/main/java/net/minecraft/server/NetworkManager.java
|
|
@@ -45,6 +45,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;
|
|
@@ -73,6 +74,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);
|
|
}
|
|
|
|
@@ -191,6 +195,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.9.1
|
|
|