mirror of
https://github.com/IntQuant/noita_entangled_worlds.git
synced 2025-10-19 07:03:16 +00:00
Prevent proxy from crashing when can't connect by ip.
This commit is contained in:
parent
b822c656b4
commit
1267b0e87c
6 changed files with 48 additions and 0 deletions
|
@ -127,3 +127,8 @@ Shift-hue = Shift hue
|
|||
Show-debug-info = Show debug info
|
||||
hint_spectate = Use [',' or d-pad-left] and ['.' or d-pad-right] keys to spectate over other players.
|
||||
hint_ping = [Middle mouse button or right thumb stick] spawns a ping
|
||||
|
||||
## IP Connect
|
||||
|
||||
ip_could_not_connect = Could not connect
|
||||
ip_wait_for_connection = Connecting to ip...
|
|
@ -127,3 +127,8 @@ Shift-hue = Shift hue
|
|||
Show-debug-info = Show debug info
|
||||
hint_spectate = Use [',' or d-pad-left] and ['.' or d-pad-right] keys to spectate over other players.
|
||||
hint_ping = [Middle mouse button or right thumb stick] spawns a ping
|
||||
|
||||
## IP Connect
|
||||
|
||||
ip_could_not_connect = Could not connect
|
||||
ip_wait_for_connection = Connecting to ip...
|
|
@ -110,3 +110,8 @@ Shift-hue = Shift hue
|
|||
Show-debug-info = Show debug info
|
||||
hint_spectate = Use [',' or d-pad-left] and ['.' or d-pad-right] keys to spectate over other players.
|
||||
hint_ping = [Middle mouse button or right thumb stick] spawns a ping
|
||||
|
||||
## IP Connect
|
||||
|
||||
ip_could_not_connect = Could not connect
|
||||
ip_wait_for_connection = Connecting to ip...
|
|
@ -127,3 +127,8 @@ Shift-hue = Shift hue
|
|||
Show-debug-info = Show debug info
|
||||
hint_spectate = Use [',' or d-pad-left] and ['.' or d-pad-right] keys to spectate over other players.
|
||||
hint_ping = [Middle mouse button or right thumb stick] spawns a ping
|
||||
|
||||
## IP Connect
|
||||
|
||||
ip_could_not_connect = Could not connect
|
||||
ip_wait_for_connection = Connecting to ip...
|
|
@ -23,6 +23,7 @@ use self_update::SelfUpdateManager;
|
|||
use serde::{Deserialize, Serialize};
|
||||
use std::{
|
||||
fmt::Display,
|
||||
mem,
|
||||
net::SocketAddr,
|
||||
ops::Deref,
|
||||
sync::{atomic::Ordering, Arc},
|
||||
|
@ -119,6 +120,9 @@ impl Drop for NetManStopOnDrop {
|
|||
enum AppState {
|
||||
Connect,
|
||||
ModManager,
|
||||
TangledConnecting {
|
||||
peer: tangled::Peer,
|
||||
},
|
||||
Netman {
|
||||
netman: NetManStopOnDrop,
|
||||
noita_launcher: NoitaLauncher,
|
||||
|
@ -425,6 +429,10 @@ impl App {
|
|||
|
||||
fn start_connect(&mut self, addr: SocketAddr) {
|
||||
let peer = Peer::connect(addr, None).unwrap();
|
||||
self.state = AppState::TangledConnecting { peer };
|
||||
}
|
||||
|
||||
fn start_connect_step_2(&mut self, peer: Peer) {
|
||||
let netman = net::NetManager::new(PeerVariant::Tangled(peer), self.get_netman_init());
|
||||
self.change_state_to_netman(netman, player_path(self.modmanager_settings.mod_path()));
|
||||
}
|
||||
|
@ -1077,6 +1085,25 @@ impl eframe::App for App {
|
|||
});
|
||||
});
|
||||
}
|
||||
AppState::TangledConnecting { peer } => {
|
||||
egui::CentralPanel::default().show(ctx, |ui| {
|
||||
ui.label(tr("ip_wait_for_connection"));
|
||||
});
|
||||
if peer.state() == tangled::PeerState::Disconnected {
|
||||
self.state = AppState::Error {
|
||||
message: tr("ip_could_not_connect"),
|
||||
};
|
||||
return;
|
||||
}
|
||||
if peer.my_id().is_some() {
|
||||
let AppState::TangledConnecting { peer } =
|
||||
mem::replace(&mut self.state, AppState::Connect)
|
||||
else {
|
||||
unreachable!();
|
||||
};
|
||||
self.start_connect_step_2(peer);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -397,6 +397,7 @@ impl ConnectionManager {
|
|||
.send(InternalEvent::Connected(host_conn.remote_id))
|
||||
.expect("channel to be open");
|
||||
self.host_conn = Some(host_conn);
|
||||
self.shared.peer_state.store(PeerState::Connected);
|
||||
}
|
||||
Err(err) => {
|
||||
error!("Could not connect to host: {}", err);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue