diff --git a/src/runtime2/port.rs b/src/runtime2/port.rs index a4503b7ca237a1a045c634fc4210715ef8d9cf61..42b9ee27cfa77e70e25dc084aa8a382aeeefd9f3 100644 --- a/src/runtime2/port.rs +++ b/src/runtime2/port.rs @@ -27,14 +27,22 @@ pub enum PortKind { Getter, } -/// Represents a port inside of the runtime. May be without owner if it is -/// created by the application interfacing with the runtime, instead of being -/// created by a connector. +#[derive(Debug, Eq, PartialEq)] +pub enum PortState { + Open, + Closed, +} + +/// Represents a port inside of the runtime. This is generally the local view of +/// a connector on its port, which may not be consistent with the rest of the +/// global system (e.g. its peer was moved to a new connector, or the peer might +/// have died in the meantime, so it is no longer usable). pub struct Port { pub self_id: PortIdLocal, pub peer_id: PortIdLocal, pub kind: PortKind, - pub peer_connector: ConnectorId, // might be temporarily inconsistent while peer port is sent around in non-sync phase. + pub state: PortState, + pub peer_connector: ConnectorId, // might be temporarily inconsistent while peer port is sent around in non-sync phase }