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 #6598: prevent client crashes due to failing connects #9163
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR feels a bit messy till I started to look at the commits one by one. There are two seemly unrelated fixes in this PR.
I would suggest we do not backport the first part, as it touches parts that should not go in 1.11 to start with.
The second part might be worth it, but honestly, I don't know if it does. If we do, it might be good to split this into two PRs, but I leave this fully up to you :)
NetworkClientConnectGame already does a NetworkDisconnect, so no reason to do it here
…oin from within a network game One could join a network game from within an already running network game. This would call a NetworkDisconnect, but keeps the UI alive. If, during that process the join is aborted, e.g. by cancelling on a password dialog, you would still be in your network game but also get shown the server list. Solve all the underlying problems by falling back to the main UI when (re)connecting to a(nother) server.
Closes #6598
Motivation / Problem
See #6598. Though the premise is, if you are in a network game and you use (re)connect from the console you can get into a weird limbo state when that attempt fails. This is mostly due to NetworkDisconnect closing/freeing things that might be used later, causing many potential places with reading invalid data.
Description
The first step is to remove the NetworkDisconnect from the
connect
command. This solves all cases where a client tries to join an invalid company number.The second step is more involved. Upon the join it checks whether the user is in main menu. When it is in the main menu, it will happily continue. When it is not in the main menu, it will load the main menu and trigger the join process to start.
Limitations
Reconnect and connect from within a network game is now slower as it first needs to load the main menu.
Backporting
Backport the following commits:
_network_join_...
variables and adding a_network_join_address
variable that can be "local" to network.cpp. The strecpy with last_join should be kept out too.Leave the following two commits out / do not backport:
Checklist for review
Some things are not automated, and forgotten often. This list is a reminder for the reviewers.