Преглед на файлове

tau: stop sync_loop_task first to gracefully shut it down

dasman преди 1 година
родител
ревизия
81b879b25e
променени са 1 файла, в които са добавени 6 реда и са изтрити 6 реда
  1. 6 6
      bin/tau/taud/src/main.rs

+ 6 - 6
bin/tau/taud/src/main.rs

@@ -615,7 +615,7 @@ async fn realmain(settings: Args, executor: Arc<smol::Executor<'static>>) -> Res
         |res| async {
             match res {
                 Ok(()) | Err(TaudError::Darkfi(Error::DetachedTaskStopped)) => { /* Do nothing */ }
-                Err(e) => error!(target: "taud", "Failed starting sync loop task: {}", e),
+                Err(e) => error!(target: "taud", "Failed stopping sync loop task: {}", e),
             }
         },
         TaudError::Darkfi(Error::DetachedTaskStopped),
@@ -643,7 +643,7 @@ async fn realmain(settings: Args, executor: Arc<smol::Executor<'static>>) -> Res
             match res {
                 Ok(()) | Err(Error::DetachedTaskStopped) => { /* Do nothing */ }
                 Err(e) => {
-                    error!(target: "taud", "Failed starting dnet subs task: {}", e)
+                    error!(target: "taud", "Failed stopping dnet subs task: {}", e)
                 }
             }
         },
@@ -694,7 +694,7 @@ async fn realmain(settings: Args, executor: Arc<smol::Executor<'static>>) -> Res
         |res| async move {
             match res {
                 Ok(()) | Err(Error::RpcServerStopped) => rpc_interface.stop_connections().await,
-                Err(e) => error!(target: "taud", "Failed starting JSON-RPC server: {}", e),
+                Err(e) => error!(target: "taud", "Failed stopping JSON-RPC server: {}", e),
             }
         },
         Error::RpcServerStopped,
@@ -709,14 +709,14 @@ async fn realmain(settings: Args, executor: Arc<smol::Executor<'static>>) -> Res
     info!(target: "taud", "Stopping P2P network");
     p2p.stop().await;
 
+    info!(target: "taud", "Stopping sync loop task...");
+    sync_loop_task.stop().await;
+
     info!(target: "taud", "Stopping JSON-RPC server...");
     rpc_task.stop().await;
     dnet_task.stop().await;
     deg_task.stop().await;
 
-    info!(target: "taud", "Stopping sync loop task...");
-    sync_loop_task.stop().await;
-
     info!(target: "taud", "Flushing sled database...");
     let flushed_bytes = sled_db.flush_async().await?;
     info!(target: "taud", "Flushed {} bytes", flushed_bytes);