diff --git a/src/runtime2/component/consensus.rs b/src/runtime2/component/consensus.rs index b782ef0bf1d7ee20baaa589eb2b6aceaa3e1b2c6..f9f3ab3f1df69fe514ced318d8eb388adec96ea9 100644 --- a/src/runtime2/component/consensus.rs +++ b/src/runtime2/component/consensus.rs @@ -378,7 +378,10 @@ impl Consensus { /// Handles the arrival of a new data message (needs to be called for every /// new data message, even though it might not end up being received). This /// is used to determine peers of `get`ter ports. - pub(crate) fn handle_new_data_message(&mut self, comp_ctx: &CompCtx, message: &DataMessage) { + // TODO: The use of this function is rather ugly. Find a more robust + // scheme about owners of `get`ter ports not knowing about their peers. + // (also, figure out why this was written again, I forgot). + pub(crate) fn handle_incoming_data_message(&mut self, comp_ctx: &CompCtx, message: &DataMessage) { let target_handle = comp_ctx.get_port_handle(message.data_header.target_port); let target_index = comp_ctx.get_port_index(target_handle); let annotation = &mut self.ports[target_index]; @@ -504,7 +507,7 @@ impl Consensus { sync_header: self.create_sync_header(comp_ctx), content: SyncMessageContent::NotificationOfLeader, }; - peer.handle.send_message(sched_ctx, Message::Sync(message), true); + peer.handle.send_message(&sched_ctx.runtime, Message::Sync(message), true); } self.forward_partial_solution(sched_ctx, comp_ctx); @@ -516,7 +519,7 @@ impl Consensus { }; let peer_handle = comp_ctx.get_peer_handle(header.sending_id); let peer_info = comp_ctx.get_peer(peer_handle); - peer_info.handle.send_message(sched_ctx, Message::Sync(message), true); + peer_info.handle.send_message(&sched_ctx.runtime, Message::Sync(message), true); } // else: exactly equal } @@ -622,7 +625,7 @@ impl Consensus { sync_header: self.create_sync_header(comp_ctx), content: if is_success { SyncMessageContent::GlobalSolution } else { SyncMessageContent::GlobalFailure }, }); - handle.send_message(sched_ctx, message, true); + handle.send_message(&sched_ctx.runtime, message, true); let _should_remove = handle.decrement_users(); debug_assert!(_should_remove.is_none()); } @@ -631,7 +634,7 @@ impl Consensus { fn send_to_leader(&mut self, sched_ctx: &SchedulerCtx, comp_ctx: &CompCtx, message: Message) { debug_assert_ne!(self.highest_id, comp_ctx.id); // we're not the leader let mut leader_info = sched_ctx.runtime.get_component_public(self.highest_id); - leader_info.send_message(sched_ctx, message, true); + leader_info.send_message(&sched_ctx.runtime, message, true); let should_remove = leader_info.decrement_users(); if let Some(key) = should_remove { sched_ctx.runtime.destroy_component(key);