diff --git a/src/runtime2/communication.rs b/src/runtime2/communication.rs index cebb7b67d319eb1fb2106c9ac06857d5a575659f..335f4c6d0864416a0135f0c9522eb433f19f3328 100644 --- a/src/runtime2/communication.rs +++ b/src/runtime2/communication.rs @@ -17,29 +17,6 @@ impl PortId { } } -#[derive(Debug, PartialEq, Eq, Clone, Copy)] -pub enum PortKind { - Putter, - Getter, -} - -#[derive(Debug, Clone, Copy, PartialEq, Eq)] -pub enum PortState { - Open, - BlockedDueToPeerChange, - BlockedDueToFullBuffers, - Closed, -} - -impl PortState { - pub fn is_blocked(&self) -> bool { - match self { - PortState::BlockedDueToPeerChange | PortState::BlockedDueToFullBuffers => true, - PortState::Open | PortState::Closed => false, - } - } -} - pub struct Channel { pub putter_id: PortId, pub getter_id: PortId, @@ -111,6 +88,7 @@ pub struct SyncSolutionGetterPort { pub peer_comp_id: CompId, pub peer_port_id: PortId, pub mapping: u32, + pub failed: bool, } /// Putter port in a solution. A putter may not be certain about who its peer @@ -120,6 +98,7 @@ pub struct SyncSolutionPutterPort { pub self_comp_id: CompId, pub self_port_id: PortId, pub mapping: u32, + pub failed: bool, } #[derive(Debug)] @@ -171,14 +150,21 @@ pub struct ControlMessage { pub content: ControlMessageContent, } +/// Content of a control message. If the content refers to a port then the +/// `target_port_id` field is the one that it refers to. #[derive(Copy, Clone, Debug)] pub enum ControlMessageContent { Ack, - BlockPort(PortId), - UnblockPort(PortId), - ClosePort(PortId), - PortPeerChangedBlock(PortId), - PortPeerChangedUnblock(PortId, CompId), + BlockPort, + UnblockPort, + ClosePort(ControlMessageClosePort), + PortPeerChangedBlock, + PortPeerChangedUnblock(PortId, CompId), // contains (new_port_id, new_component_id) +} + +#[derive(Copy, Clone, Debug)] +pub struct ControlMessageClosePort { + pub closed_in_sync_round: bool, // needed to ensure correct handling of errors } // -----------------------------------------------------------------------------