summaryrefslogtreecommitdiff
path: root/common/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'common/src/lib.rs')
-rw-r--r--common/src/lib.rs4
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>>();