From fbd114f7242b8819ae91953e75948279cc62068c Mon Sep 17 00:00:00 2001 From: Youngjoon Lee <5462944+youngjoon-lee@users.noreply.github.com> Date: Thu, 7 Nov 2024 11:55:02 +0900 Subject: [PATCH] Count # of messages broadcasted by each node (#21) --- network-runner/src/node/mix/mod.rs | 4 +++- network-runner/src/node/mix/state.rs | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/network-runner/src/node/mix/mod.rs b/network-runner/src/node/mix/mod.rs index 44dc5d4..e3496dd 100644 --- a/network-runner/src/node/mix/mod.rs +++ b/network-runner/src/node/mix/mod.rs @@ -143,6 +143,7 @@ impl MixNode { node_id: id, mock_counter: 0, step_id: 0, + num_messages_broadcasted: 0, }, msg_gen_rng: ChaCha12Rng::from_rng(&mut rng_generator).unwrap(), persistent_sender, @@ -217,7 +218,8 @@ impl Node for MixNode { persistent_sender.send(msg).unwrap(); } MixOutgoingMessage::FullyUnwrapped(_) => { - //TODO: increase counter and create a tracing event + self.state.num_messages_broadcasted += 1; + //TODO: create a tracing event } } } diff --git a/network-runner/src/node/mix/state.rs b/network-runner/src/node/mix/state.rs index 10ce58f..688d39a 100644 --- a/network-runner/src/node/mix/state.rs +++ b/network-runner/src/node/mix/state.rs @@ -14,6 +14,7 @@ pub struct MixnodeState { pub node_id: NodeId, pub mock_counter: usize, pub step_id: usize, + pub num_messages_broadcasted: usize, } #[derive(Serialize)]