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. By: Jonas Konrad <me@yawk.at>
This commit is contained in:
@@ -43,3 +43,14 @@
|
||||
Iterator<Connection> iterator = this.connections.iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
@@ -176,6 +193,10 @@
|
||||
networkmanager.setReadOnly();
|
||||
}
|
||||
} else {
|
||||
+ // Spigot Start
|
||||
+ // Fix a race condition where a NetworkManager could be unregistered just before connection.
|
||||
+ if (networkmanager.preparing) continue;
|
||||
+ // Spigot End
|
||||
iterator.remove();
|
||||
networkmanager.handleDisconnection();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user