diff --git a/src/runtime/mod.rs b/src/runtime/mod.rs index 97b6c36ddfb3fcd0a90f670c1292de4198f8aec6..7e4730a973f4995c4c33aa25ccfad6199ceefc23 100644 --- a/src/runtime/mod.rs +++ b/src/runtime/mod.rs @@ -151,6 +151,7 @@ pub struct PortInfo { routes: HashMap, } #[derive(Debug)] +// #[repr(C)] pub struct Connector { unphased: ConnectorUnphased, phased: ConnectorPhased, @@ -176,7 +177,7 @@ pub struct ConnectorUnphased { #[derive(Debug)] pub enum ConnectorPhased { Setup { endpoint_setups: Vec<(PortId, EndpointSetup)>, surplus_sockets: u16 }, - Communication(ConnectorCommunication), + Communication(Box), } #[derive(Default, Clone, Eq, PartialEq, Hash, serde::Serialize, serde::Deserialize)] pub struct Predicate { @@ -203,7 +204,12 @@ pub struct SyncProtoContext<'a> { inbox: &'a HashMap, } //////////////// - +pub fn random_connector_id() -> ConnectorId { + type Bytes8 = [u8; std::mem::size_of::()]; + let mut bytes = Bytes8::default(); + getrandom::getrandom(&mut bytes).unwrap(); + unsafe { std::mem::transmute::(bytes) } +} pub fn would_block(err: &std::io::Error) -> bool { err.kind() == std::io::ErrorKind::WouldBlock }