Compare commits

...

2 Commits

Author SHA1 Message Date
Jędrzej Stuczyński b151fcb353 wasm fix 2025-09-18 06:48:25 +01:00
Jędrzej Stuczyński 10b639347b chore: remove Option wrapper from ShutdownTracker on the client 2025-09-17 15:07:05 +01:00
5 changed files with 9 additions and 24 deletions
@@ -1050,7 +1050,7 @@ where
gateway_connection: GatewayConnection { gateway_ws_fd },
},
stats_reporter,
shutdown_handle: Some(shutdown_tracker), // The primary tracker for this client
shutdown_handle: shutdown_tracker, // The primary tracker for this client
client_request_sender,
forget_me: self.config.debug.forget_me,
remember_me: self.config.debug.remember_me,
@@ -1066,7 +1066,7 @@ pub struct BaseClient {
pub client_state: ClientState,
pub stats_reporter: ClientStatsSender,
pub client_request_sender: ClientRequestSender,
pub shutdown_handle: Option<ShutdownTracker>,
pub shutdown_handle: ShutdownTracker,
pub forget_me: ForgetMe,
pub remember_me: RememberMe,
}
+2 -9
View File
@@ -751,13 +751,6 @@ where
let packet_type = self.config.debug_config.traffic.packet_type;
let (mut started_client, nym_address) = self.connect_to_mixnet_common().await?;
// TODO: more graceful handling here, surely both variants should work... I think?
let Some(tracker) = started_client.shutdown_handle else {
return Err(Error::new_unsupported(
"connecting with socks5 is currently unsupported with custom shutdown",
));
};
let client_input = started_client.client_input.register_producer();
let client_output = started_client.client_output.register_consumer();
let client_state = started_client.client_state;
@@ -769,14 +762,14 @@ where
client_output,
client_state.clone(),
nym_address,
tracker.child_tracker(),
started_client.shutdown_handle.child_tracker(),
packet_type,
);
Ok(Socks5MixnetClient {
nym_address,
client_state,
task_handle: tracker,
task_handle: started_client.shutdown_handle,
socks5_config,
})
}
+3 -5
View File
@@ -52,7 +52,7 @@ pub struct MixnetClient {
pub(crate) stats_events_reporter: ClientStatsSender,
/// The task manager that controls all the spawned tasks that the clients uses to do it's job.
pub(crate) shutdown_handle: Option<ShutdownTracker>,
pub(crate) shutdown_handle: ShutdownTracker,
pub(crate) packet_type: Option<PacketType>,
// internal state used for the `Stream` implementation
@@ -72,7 +72,7 @@ impl MixnetClient {
client_state: ClientState,
reconstructed_receiver: ReconstructedMessagesReceiver,
stats_events_reporter: ClientStatsSender,
task_handle: Option<ShutdownTracker>,
task_handle: ShutdownTracker,
packet_type: Option<PacketType>,
client_request_sender: ClientRequestSender,
forget_me: ForgetMe,
@@ -238,9 +238,7 @@ impl MixnetClient {
tokio::time::sleep(tokio::time::Duration::from_secs(2)).await;
}
if let Some(tracker) = self.shutdown_handle {
tracker.shutdown().await;
}
self.shutdown_handle.shutdown().await
}
pub async fn send_forget_me(&self) -> Result<()> {
+1 -3
View File
@@ -250,9 +250,7 @@ impl NymClientBuilder {
client_state: Arc::new(started_client.client_state),
_full_topology: None,
// this cannot fail as we haven't passed an external task manager
_task_manager: started_client
.shutdown_handle
.expect("shutdown manager missing"),
_task_manager: started_client.shutdown_handle,
packet_type,
})
}
+1 -5
View File
@@ -188,11 +188,7 @@ impl MixFetchClientBuilder {
client_input,
requests: active_requests,
// this cannot fail as we haven't passed an external task manager
_shutdown_manager: Mutex::new(
started_client
.shutdown_handle
.expect("shutdown manager missing"),
),
_shutdown_manager: Mutex::new(started_client.shutdown_handle),
})
}
}