Selaa lähdekoodia

dchatd: bugfix

shutdown p2p network only after other tasks have been shutdown
draoi 2 vuotta sitten
vanhempi
sitoutus
ffee76843a
1 muutettua tiedostoa jossa 5 lisäystä ja 3 poistoa
  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?;
     signals_handler.wait_termination(signals_task).await?;
     info!("Caught termination signal, cleaning up and exiting...");
     info!("Caught termination signal, cleaning up and exiting...");
 
 
-    info!("Stopping P2P network");
-    p2p.stop().await;
-
     info!("Stopping JSON-RPC server");
     info!("Stopping JSON-RPC server");
     rpc_task.stop().await;
     rpc_task.stop().await;
+
+    info!("Stopping dnet tasks");
     dnet_task.stop().await;
     dnet_task.stop().await;
 
 
+    info!("Stopping P2P network");
+    p2p.stop().await;
+
     info!("Shut down successfully");
     info!("Shut down successfully");
     // ANCHOR_END: shutdown
     // ANCHOR_END: shutdown
     Ok(())
     Ok(())