Просмотр исходного кода

dchatd: bugfix

shutdown p2p network only after other tasks have been shutdown
draoi 2 лет назад
Родитель
Сommit
ffee76843a
1 измененных файлов с 5 добавлено и 3 удалено
  1. 5 3
      example/dchat/dchatd/src/main.rs

+ 5 - 3
example/dchat/dchatd/src/main.rs

@@ -169,13 +169,15 @@ async fn realmain(args: Args, ex: Arc<smol::Executor<'static>>) -> Result<()> {
     signals_handler.wait_termination(signals_task).await?;
     info!("Caught termination signal, cleaning up and exiting...");
 
-    info!("Stopping P2P network");
-    p2p.stop().await;
-
     info!("Stopping JSON-RPC server");
     rpc_task.stop().await;
+
+    info!("Stopping dnet tasks");
     dnet_task.stop().await;
 
+    info!("Stopping P2P network");
+    p2p.stop().await;
+
     info!("Shut down successfully");
     // ANCHOR_END: shutdown
     Ok(())