trifid/tfclient/src/nebulaworker_inert.rs

34 lines
1000 B
Rust
Raw Normal View History

// Code to handle the nebula worker
// This is an inert version of the nebula worker that does nothing, used when linking to nebula is diabled.
// This is useful if you wish to run your own nebula binary, for example on platforms where CGo does not work.
use crate::config::TFClientConfig;
use crate::daemon::ThreadMessageSender;
use std::sync::mpsc::Receiver;
pub enum NebulaWorkerMessage {
Shutdown,
ConfigUpdated,
WakeUp,
}
2023-07-12 15:53:05 +00:00
pub fn nebulaworker_main(_config: TFClientConfig, _instance: String, _transmitter: ThreadMessageSender, rx: Receiver<NebulaWorkerMessage>) {
loop {
match rx.recv() {
Ok(msg) => match msg {
NebulaWorkerMessage::WakeUp => {
continue;
},
NebulaWorkerMessage::Shutdown => {
break;
}
_ => ()
2023-07-12 15:53:52 +00:00
},
Err(e) => {
error!("{}", e);
break;
2023-07-12 15:53:05 +00:00
}
}
}
}