Start to make dynamic interfaces work

This commit is contained in:
Michael Mikovsky
2025-12-21 00:35:28 -07:00
parent 1ea26641d6
commit c7d66c5560
26 changed files with 720 additions and 296 deletions
-19
View File
@@ -177,21 +177,6 @@ dependencies = [
"libc",
]
[[package]]
name = "crossbeam-channel"
version = "0.5.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "82b8f8f868b36967f9606790d1903570de9ceaf870a7bf9fbbd3016d636a2cb2"
dependencies = [
"crossbeam-utils",
]
[[package]]
name = "crossbeam-utils"
version = "0.8.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28"
[[package]]
name = "crypto-common"
version = "0.1.7"
@@ -650,11 +635,7 @@ dependencies = [
name = "unshell-lib"
version = "0.0.0"
dependencies = [
"bincode",
"chrono",
"crossbeam-channel",
"libc",
"rand",
"serde",
"serde_json",
"unshell-obfuscate",
+2 -2
View File
@@ -1,7 +1,7 @@
mod manager;
mod module;
mod module_interface;
pub mod network;
// pub mod network;
mod proc_load;
pub mod interface;
@@ -11,7 +11,7 @@ use std::sync::{Arc, Mutex};
pub use manager::Manager;
pub use module::Module;
pub use interface::{InterfaceWrapper, NamedComponent};
pub use interface::{InterfaceWrapper, NamedComponent, PayloadConfig};
extern crate unshell_lib;
use unshell_lib::Result;
+7 -7
View File
@@ -1,6 +1,6 @@
use unshell_lib::{Announcement, Result};
use crate::network::Stream;
// use crate::network::Stream;
use crate::Manager;
@@ -27,10 +27,10 @@ impl Manager {
}
}
pub fn broadcast(&mut self, announcement: Announcement) -> Result<()> {
for connection in &mut self.connections {
connection.write(announcement.clone())?;
}
Ok(())
}
// pub fn broadcast(&mut self, announcement: Announcement) -> Result<()> {
// for connection in &mut self.connections {
// connection.write(announcement.clone())?;
// }
// Ok(())
// }
}
+8 -10
View File
@@ -1,5 +1,5 @@
mod announcement;
mod connection;
// mod connection;
use std::{
collections::HashMap,
@@ -15,7 +15,7 @@ use crate::{
ModuleRuntime,
interface::{NamedComponent, PayloadConfig},
module::Module,
network::Stream,
// network::Stream,
};
// #[derive(Debug)]
@@ -28,8 +28,7 @@ pub struct Manager {
components: HashMap<String, NamedComponent>,
active_runtimes: Vec<Box<dyn ModuleRuntime>>,
pub connections: Vec<Box<dyn Stream<Announcement>>>,
// pub connections: Vec<Box<dyn Stream<Announcement>>>,
}
// static mut MANAGER_RUNTIME: Option<Arc<Mutex<Manager>>> = None;
@@ -46,8 +45,7 @@ impl Manager {
.map(|c| (c.name.to_string(), c))
.collect(),
active_runtimes: Vec::new(),
connections: Vec::new(),
// connections: Vec::new(),
}
}
@@ -130,11 +128,11 @@ impl Manager {
}
});
// Read announcements
this_lock.recv_connection_announcements();
// // Read announcements
// this_lock.recv_connection_announcements();
// Prune dead connections
this_lock.prune_connections();
// // Prune dead connections
// this_lock.prune_connections();
drop(this_lock)
}