From da4b59fb42d2d9216f1ec47c30d9b3733fd3f390 Mon Sep 17 00:00:00 2001 From: occheung Date: Thu, 19 Sep 2024 17:13:44 +0800 Subject: [PATCH] mgmt: minor fix --- src/runtime/src/mgmt.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/runtime/src/mgmt.rs b/src/runtime/src/mgmt.rs index efec891..e27b8a1 100644 --- a/src/runtime/src/mgmt.rs +++ b/src/runtime/src/mgmt.rs @@ -755,7 +755,7 @@ mod local_coremgmt { } pub async fn config_write(stream: &mut TcpStream, cfg: &Rc, key: &String, value: Vec, restart_idle: &Rc) -> Result<()> { - let value = cfg.write(&key, buffer); + let value = cfg.write(&key, value); if value.is_ok() { debug!("write success"); if key == "idle_kernel" { @@ -771,7 +771,6 @@ mod local_coremgmt { } pub async fn config_remove(stream: &mut TcpStream, cfg: &Rc, key: &String, restart_idle: &Rc) -> Result<()> { - let key = read_key(stream).await?; debug!("erase key: {}", key); let value = cfg.remove(&key); if value.is_ok() { @@ -888,11 +887,11 @@ 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) @@ -920,7 +919,7 @@ async fn handle_connection( } } -pub fn start(cfg: Config, 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 { @@ -929,6 +928,7 @@ pub fn start(cfg: Config, restart_idle: Rc, drtio_tuple: Option<(&Rc< let mut stream = TcpStream::accept(1380, 2048, 2048).await.unwrap(); let pull_id = pull_id.clone(); let cfg = cfg.clone(); + let restart_idle = restart_idle.clone(); let drtio_tuple = drtio_tuple.clone(); task::spawn(async move { info!("received connection");