diff --git a/src/runtime2/component/control_layer.rs b/src/runtime2/component/control_layer.rs index da7bae60bb8b257f65b3b9e05780aeda5fc1b267..c21c9e81c9cc1bc355fc8af2b0a3687a92d5cc0f 100644 --- a/src/runtime2/component/control_layer.rs +++ b/src/runtime2/component/control_layer.rs @@ -129,7 +129,7 @@ impl ControlLayer { let port_info = comp_ctx.get_port(port_handle); let port_peer_comp_id = port_info.peer_comp_id; debug_assert_eq!(port_info.state, PortState::Closed); - comp_ctx.remove_peer(sched_ctx, port_handle, port_peer_comp_id); + comp_ctx.remove_peer(sched_ctx, port_handle, port_peer_comp_id, true); // remove if closed return (AckAction::None, None); } @@ -201,6 +201,19 @@ impl ControlLayer { // Blocking, unblocking, and closing ports // ------------------------------------------------------------------------- + pub(crate) fn has_close_port_entry(&self, port_handle: LocalPortHandle, comp_ctx: &CompCtx) -> Option { + let port = comp_ctx.get_port(port_handle); + let port_id = port.self_id; + for entry in self.entries.iter() { + if let ControlContent::ClosedPort(entry_port_id) = &entry.content { + if *entry_port_id == port_id { + return Some(entry.id); + } + } + } + + return None; + } /// Initiates the control message procedures for closing a port. Caller must /// make sure that the port state has already been set to `Closed`.