fixed connection reconnection logic

This commit is contained in:
2026-02-08 00:54:31 +08:00
parent 4ad6fb709c
commit f0cb2fd1d0
7 changed files with 141 additions and 28 deletions

View File

@@ -1,19 +1,22 @@
#[derive(Clone)]
pub struct Clients {
pub http_client: reqwest::Client,
pub ws_client: Option<rust_socketio::client::Client>,
pub is_ws_initialized: bool,
pub ws_emit_failures: u8,
}
pub struct NetworkState {
pub clients: Option<Clients>,
pub health_monitor_token: Option<tokio_util::sync::CancellationToken>,
}
impl Default for NetworkState {
fn default() -> Self {
Self { clients: None }
Self {
clients: None,
health_monitor_token: None,
}
}
}
@@ -30,6 +33,8 @@ pub fn init_network_state() -> NetworkState {
http_client,
ws_client: None,
is_ws_initialized: false,
ws_emit_failures: 0,
}),
health_monitor_token: None,
}
}
}