diff --git a/src/runtime2/global_store.rs b/src/runtime2/global_store.rs index e71494f58f910e269179d5e47fbdfd28cffca18b..4d1727af58fd65e42030dca6e874baab875504bb 100644 --- a/src/runtime2/global_store.rs +++ b/src/runtime2/global_store.rs @@ -44,6 +44,11 @@ impl ConnectorId { pub fn new_invalid() -> ConnectorId { return ConnectorId(u32::MAX); } + + #[inline] + pub(crate) fn is_valid(&self) -> bool { + return self.0 != u32::MAX; + } } // TODO: Change this, I hate this. But I also don't want to put `public` and @@ -135,7 +140,14 @@ impl ConnectorStore { } } - return ConnectorKey{ index: index as u32 }; + // TODO: Clean up together with the trait + let key = ConnectorKey{ index: index as u32 }; + let connector = self.get_mut(&key); + if let ConnectorVariant::UserDefined(connector) = &mut connector.connector { + connector.set_connector_id(key.downcast()); + } + + return key; } pub(crate) fn destroy(&self, key: ConnectorKey) {