// Code to handle the nebula worker use std::sync::mpsc::{Receiver, TryRecvError}; use log::{error, info}; use crate::config::TFClientConfig; use crate::daemon::ThreadMessageSender; pub enum NebulaWorkerMessage { Shutdown, ConfigUpdated } pub fn nebulaworker_main(_config: TFClientConfig, _transmitter: ThreadMessageSender, rx: Receiver) { loop { match rx.try_recv() { Ok(msg) => { match msg { NebulaWorkerMessage::Shutdown => { info!("recv on command socket: shutdown, stopping"); break; }, NebulaWorkerMessage::ConfigUpdated => { info!("our configuration has been updated - reloading"); } } }, Err(e) => { match e { TryRecvError::Empty => {} TryRecvError::Disconnected => { error!("nebulaworker command socket disconnected, shutting down to prevent orphaning"); break; } } } } } }