diff --git a/src/runtime/src/comms.rs b/src/runtime/src/comms.rs index f8ea93c..2ded8bb 100644 --- a/src/runtime/src/comms.rs +++ b/src/runtime/src/comms.rs @@ -785,7 +785,11 @@ pub fn main(timer: GlobalTimer, cfg: Config) { let cfg = Rc::new(cfg); let restart_idle = Rc::new(Semaphore::new(1, 1)); - mgmt::start(cfg.clone(), restart_idle.clone(), Some((&aux_mutex, &drtio_routing_table, timer))); + mgmt::start( + cfg.clone(), + restart_idle.clone(), + Some((&aux_mutex, &drtio_routing_table, timer)), + ); task::spawn(async move { let connection = Rc::new(Semaphore::new(1, 1)); diff --git a/src/runtime/src/mgmt.rs b/src/runtime/src/mgmt.rs index 69c1d8d..0a51ae9 100644 --- a/src/runtime/src/mgmt.rs +++ b/src/runtime/src/mgmt.rs @@ -761,7 +761,13 @@ mod local_coremgmt { Ok(()) } - pub async fn config_write(stream: &mut TcpStream, cfg: &Rc, key: &String, value: Vec, restart_idle: &Rc) -> Result<()> { + pub async fn config_write( + stream: &mut TcpStream, + cfg: &Rc, + key: &String, + value: Vec, + restart_idle: &Rc, + ) -> Result<()> { let value = cfg.write(&key, value); if value.is_ok() { debug!("write success"); @@ -777,7 +783,12 @@ mod local_coremgmt { Ok(()) } - pub async fn config_remove(stream: &mut TcpStream, cfg: &Rc, key: &String, restart_idle: &Rc) -> Result<()> { + pub async fn config_remove( + stream: &mut TcpStream, + cfg: &Rc, + key: &String, + restart_idle: &Rc, + ) -> Result<()> { debug!("erase key: {}", key); let value = cfg.remove(&key); if value.is_ok() { @@ -894,11 +905,28 @@ async fn handle_connection( buffer.set_len(len); } read_chunk(stream, &mut buffer).await?; - process!(stream, _drtio_tuple, _destination, config_write, &cfg, &key, buffer, &restart_idle) + process!( + stream, + _drtio_tuple, + _destination, + config_write, + &cfg, + &key, + buffer, + &restart_idle + ) } Request::ConfigRemove => { let key = read_key(stream).await?; - process!(stream, _drtio_tuple, _destination, config_remove, &cfg, &key, &restart_idle) + process!( + stream, + _drtio_tuple, + _destination, + config_remove, + &cfg, + &key, + &restart_idle + ) } Request::Reboot => { process!(stream, _drtio_tuple, _destination, reboot) @@ -926,7 +954,11 @@ async fn handle_connection( } } -pub fn start(cfg: Rc, restart_idle: Rc, drtio_tuple: Option<(&Rc>, &Rc>, GlobalTimer)>) { +pub fn start( + cfg: Rc, + restart_idle: Rc, + drtio_tuple: Option<(&Rc>, &Rc>, GlobalTimer)>, +) { let drtio_tuple = drtio_tuple.map(|(aux_mutex, routing_table, timer)| (aux_mutex.clone(), routing_table.clone(), timer)); task::spawn(async move {