Browse Source

avoid blocking by making jsonserver run after gateway client started

ghassmo 5 năm trước cách đây
mục cha
commit
eb8d2633c8
1 tập tin đã thay đổi với 4 bổ sung4 xóa
  1. 4 4
      src/bin/darkfid.rs

+ 4 - 4
src/bin/darkfid.rs

@@ -210,10 +210,6 @@ async fn start(executor: Arc<Executor<'_>>, options: Arc<ClientProgramOptions>)
         wallet: wallet.clone(),
     };
 
-    let adapter = RpcAdapter::new(wallet.clone())?;
-    // start the rpc server
-    jsonserver::start(ex.clone(), options.clone(), adapter).await?;
-
     // create gateway client
     let mut client = GatewayClient::new(connect_addr, slabstore)?;
 
@@ -225,6 +221,10 @@ async fn start(executor: Arc<Executor<'_>>, options: Arc<ClientProgramOptions>)
     // start gateway client
     client.start().await?;
 
+    let adapter = RpcAdapter::new(wallet.clone())?;
+    // start the rpc server
+    jsonserver::start(ex.clone(), options.clone(), adapter).await?;
+
     subscribe_task.cancel().await;
     Ok(())
 }