-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix potential race conditions when connecting to multiple servers at the same time #3746
Fix potential race conditions when connecting to multiple servers at the same time #3746
Conversation
…iguration when the connection is in Configuration phase
…d and server is null.
Throwing an IllegalStateException when canceling a ServerConnectEvent often makes no sense. After the LoginEvent completes, the proxy continues to initialize the connection by scheduling a task in the eventloop: BungeeCord/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java Lines 627 to 645 in a89cf5f
Making throwing an exception completely pointless, since it won't disconnect the player since it happens outside the context of the handler. |
How is such a wrong state being handled now by the code that a kick from this check is no longer needed? i. e. why remove the check instead of making it a kick? |
Because the logic itself almost never worked correctly it seemed to me that the best solution was not to close the connection if the ServerConnectEvent was cancelled with a null server, allowing the plugins to decide what to do next in such a situation, keeping the player on the proxy server. Alternatively, we could add a flag to the ServerConnectEvent that would allow the player to remain in this state, but now I'm not sure what the best way to handle this situation is. |
This pull request fixes 2 very rare bugs that cause a race condition when connecting to a server.
This pull request fixes this by scheduling the connection to the server in an eventloop.
This most often happens when the proxy opens multiple connections to different servers at the same time.
This pull request fixes this by ensuring that the StartConfiguration packet is only sent when the client is not in the Configuration phase.