Function to cancel pending server connections in the login screen.

This commit is contained in:
Carbonhell
2019-09-29 19:12:26 +00:00
committed by Monty Marz
parent 9b19fcc49b
commit 6f6fdd87af
2 changed files with 70 additions and 54 deletions

View File

@ -116,6 +116,13 @@ impl PlayState for MainMenuState {
.login_error("Invalid username or password".to_string());
}
}
MainMenuEvent::CancelLoginAttempt => {
// client_init contains Some(ClientInit), which spawns a thread which contains a TcpStream::connect() call
// This call is blocking
// TODO fix when the network rework happens
client_init = None;
self.main_menu_ui.cancel_connection();
}
#[cfg(feature = "singleplayer")]
MainMenuEvent::StartSingleplayer => {
return PlayStateResult::Push(Box::new(StartSingleplayerState::new()));