From 590e9c289fc8b039a238fd2d426390e50ac2e642 Mon Sep 17 00:00:00 2001 From: Youngjoon Lee <5462944+youngjoon-lee@users.noreply.github.com> Date: Fri, 15 Nov 2024 11:19:04 +0900 Subject: [PATCH] Remove log of immediate forwardings (#52) --- simlib/mixnet-sims/src/node/mix/mod.rs | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/simlib/mixnet-sims/src/node/mix/mod.rs b/simlib/mixnet-sims/src/node/mix/mod.rs index 215e318..8dbacd1 100644 --- a/simlib/mixnet-sims/src/node/mix/mod.rs +++ b/simlib/mixnet-sims/src/node/mix/mod.rs @@ -210,7 +210,12 @@ impl MixNode { } } - fn forward(&mut self, message: MixMessage, exclude_node: Option, log: EmissionLog) { + fn forward( + &mut self, + message: MixMessage, + exclude_node: Option, + log: Option, + ) { for (i, node_id) in self .settings .connected_peers @@ -219,7 +224,9 @@ impl MixNode { .enumerate() { if i == 0 { - Self::log_emission(&log); + if let Some(log) = &log { + Self::log_emission(log); + } } self.network_interface .send_message(*node_id, message.clone()) @@ -322,7 +329,7 @@ impl Node for MixNode { self.forward( network_message.payload().clone(), Some(network_message.from), - self.new_emission_log("ImmediateForwarding"), + None, ); self.blend_sender .send(network_message.into_payload().0) @@ -362,7 +369,7 @@ impl Node for MixNode { self.forward( MixMessage(msg), None, - self.new_emission_log("FromPersistent"), + Some(self.new_emission_log("FromPersistent")), ); }