diff options
author | Aria <me@aria.rip> | 2023-10-19 21:00:26 +0100 |
---|---|---|
committer | Aria <me@aria.rip> | 2023-10-19 21:00:26 +0100 |
commit | dba41282cac86a740c007498709e996b9fa3e59b (patch) | |
tree | 5d9309962f55ca00be6fee3b7ac24b7314e86f2a /common | |
parent | 07e2085190e30010ad595369a07842413bacd3d1 (diff) |
wip: broadcast message batching
Diffstat (limited to 'common')
-rw-r--r-- | common/src/lib.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/common/src/lib.rs b/common/src/lib.rs index 69a872b..bfdfa42 100644 --- a/common/src/lib.rs +++ b/common/src/lib.rs @@ -21,7 +21,7 @@ pub mod msg_id; pub trait Handler: Send + Sync + 'static { type Body: Serialize + for<'a> Deserialize<'a> + Send + Clone; - fn init(node_id: String, node_ids: Vec<String>, output: Output<Self::Body>) -> Self; + fn init(node_id: String, node_ids: Vec<String>, output: Output<Self::Body>) -> Arc<Self>; fn handle<'a>( self: &'a Arc<Self>, header: MessageHeader, @@ -63,7 +63,7 @@ pub fn run_server<H: Handler>() { fn sync_init_handler<H: Handler, R: Read, W: Write>( reader: R, mut writer: W, -) -> (H, Receiver<Message<H::Body>>) { +) -> (Arc<H>, Receiver<Message<H::Body>>) { // Receive the init message let deser = Deserializer::from_reader(reader); let mut deser = deser.into_iter::<Message<MaelstromBody>>(); |