diff --git a/common/mixnode-common/src/verloc/mod.rs b/common/mixnode-common/src/verloc/mod.rs index 8535b98100..3872f8002e 100644 --- a/common/mixnode-common/src/verloc/mod.rs +++ b/common/mixnode-common/src/verloc/mod.rs @@ -197,12 +197,12 @@ impl VerlocMeasurer { config.packet_timeout, config.connection_timeout, config.delay_between_packets, - shutdown_listener.clone(), + shutdown_listener.clone().named("VerlocPacketSender"), )), packet_listener: Arc::new(PacketListener::new( config.listening_address, Arc::clone(&identity), - shutdown_listener.clone(), + shutdown_listener.clone().named("VerlocPacketListener"), )), shutdown_listener, currently_used_api: 0, @@ -241,7 +241,7 @@ impl VerlocMeasurer { return MeasurementOutcome::Done; } - let mut shutdown_listener = self.shutdown_listener.clone(); + let mut shutdown_listener = self.shutdown_listener.clone().named("VerlocMeasurement"); shutdown_listener.mark_as_success(); for chunk in nodes_to_test.chunks(self.config.tested_nodes_batch_size) { diff --git a/common/mixnode-common/src/verloc/sender.rs b/common/mixnode-common/src/verloc/sender.rs index 665acc3145..8940738bcf 100644 --- a/common/mixnode-common/src/verloc/sender.rs +++ b/common/mixnode-common/src/verloc/sender.rs @@ -83,7 +83,7 @@ impl PacketSender { self: Arc, tested_node: TestedNode, ) -> Result { - let mut shutdown_listener = self.shutdown_listener.clone(); + let mut shutdown_listener = self.shutdown_listener.fork(tested_node.address.to_string()); shutdown_listener.mark_as_success(); let mut conn = match tokio::time::timeout( diff --git a/common/task/src/manager.rs b/common/task/src/manager.rs index a60ee39214..a99e036231 100644 --- a/common/task/src/manager.rs +++ b/common/task/src/manager.rs @@ -282,6 +282,20 @@ impl TaskClient { } } + // TODO: not convinced about the name... + pub fn fork>(&self, child_suffix: S) -> Self { + let mut child = self.clone(); + let suffix = child_suffix.into(); + let child_name = if let Some(base) = &self.name { + format!("{base}-{suffix}") + } else { + format!("unknown-{suffix}") + }; + + child.name = Some(child_name); + child + } + // just a convenience wrapper for including the shutdown name when logging // I really didn't want to create macros for that... because that seemed like an overkill. // but I guess it would have resolved needing to call `format!` for additional msg arguments diff --git a/mixnode/src/node/mod.rs b/mixnode/src/node/mod.rs index a6571adbd5..98b0c769dc 100644 --- a/mixnode/src/node/mod.rs +++ b/mixnode/src/node/mod.rs @@ -274,16 +274,19 @@ impl MixNode { let shutdown = TaskManager::default(); - let (node_stats_pointer, node_stats_update_sender) = - self.start_node_stats_controller(shutdown.subscribe()); - let delay_forwarding_channel = self - .start_packet_delay_forwarder(node_stats_update_sender.clone(), shutdown.subscribe()); + let (node_stats_pointer, node_stats_update_sender) = self + .start_node_stats_controller(shutdown.subscribe().named("node_statistics::Controller")); + let delay_forwarding_channel = self.start_packet_delay_forwarder( + node_stats_update_sender.clone(), + shutdown.subscribe().named("DelayForwarder"), + ); self.start_socket_listener( node_stats_update_sender, delay_forwarding_channel, - shutdown.subscribe(), + shutdown.subscribe().named("Listener"), ); - let atomic_verloc_results = self.start_verloc_measurements(shutdown.subscribe()); + let atomic_verloc_results = + self.start_verloc_measurements(shutdown.subscribe().named("VerlocMeasurer")); // Rocket handles shutdown on it's own, but its shutdown handling should be incorporated // with that of the rest of the tasks.