diff --git a/src/runtime2/component/consensus.rs b/src/runtime2/component/consensus.rs index 764963a2e79f5b41c55d91bbf8ffe7123ad18ae4..dc11dd2c27b065ab112be629ac1ce3d31144a575 100644 --- a/src/runtime2/component/consensus.rs +++ b/src/runtime2/component/consensus.rs @@ -355,6 +355,20 @@ impl Consensus { self.solution.clear(); } + pub(crate) fn notify_received_port(&mut self, _expected_index: usize, port_handle: LocalPortHandle, comp_ctx: &CompCtx) { + debug_assert_eq!(_expected_index, self.ports.len()); + let port_info = comp_ctx.get_port(port_handle); + self.ports.push(PortAnnotation{ + self_comp_id: comp_ctx.id, + self_port_id: port_info.self_id, + peer_comp_id: port_info.peer_comp_id, + peer_port_id: port_info.peer_port_id, + peer_discovered: false, + mapping: None, + kind: port_info.kind, + }); + } + // ------------------------------------------------------------------------- // Handling inbound and outbound messages // ------------------------------------------------------------------------- @@ -366,7 +380,10 @@ impl Consensus { let data_header = self.create_data_header_and_update_mapping(port_info); let sync_header = self.create_sync_header(comp_ctx); - return DataMessage{ data_header, sync_header, content }; + return DataMessage{ + data_header, sync_header, content, + ports: Vec::new() + }; } /// Handles the arrival of a new data message (needs to be called for every