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

bin/taud: minor changes & clean up

ghassmo 4 лет назад
Родитель
Сommit
241375e519
3 измененных файлов с 10 добавлено и 24 удалено
  1. 0 1
      Cargo.lock
  2. 0 1
      bin/taud/Cargo.toml
  3. 10 22
      bin/taud/src/main.rs

+ 0 - 1
Cargo.lock

@@ -5302,7 +5302,6 @@ dependencies = [
  "async-std",
  "async-std",
  "async-trait",
  "async-trait",
  "darkfi",
  "darkfi",
- "easy-parallel",
  "futures",
  "futures",
  "log",
  "log",
  "num_cpus",
  "num_cpus",

+ 0 - 1
bin/taud/Cargo.toml

@@ -17,7 +17,6 @@ async-std = {version = "1.10.0", features = ["attributes"]}
 async-trait = "0.1.52"
 async-trait = "0.1.52"
 async-channel = "1.6.1"
 async-channel = "1.6.1"
 async-executor = "1.4.1"
 async-executor = "1.4.1"
-easy-parallel = "3.2.0"
 
 
 # Misc
 # Misc
 log = "0.4.14"
 log = "0.4.14"

+ 10 - 22
bin/taud/src/main.rs

@@ -1,5 +1,14 @@
+use std::{
+    net::{IpAddr, Ipv4Addr, SocketAddr},
+    sync::Arc,
+};
+
 use async_executor::Executor;
 use async_executor::Executor;
 use async_trait::async_trait;
 use async_trait::async_trait;
+use log::debug;
+use serde_json::{json, Value};
+use simplelog::{ColorChoice, LevelFilter, TermLogger, TerminalMode};
+
 use darkfi::{
 use darkfi::{
     rpc::{
     rpc::{
         jsonrpc::{error as jsonerr, response as jsonresp, ErrorCode::*, JsonRequest, JsonResult},
         jsonrpc::{error as jsonerr, response as jsonresp, ErrorCode::*, JsonRequest, JsonResult},
@@ -7,14 +16,6 @@ use darkfi::{
     },
     },
     Result,
     Result,
 };
 };
-use easy_parallel::Parallel;
-use log::debug;
-use serde_json::{json, Value};
-use simplelog::{ColorChoice, LevelFilter, TermLogger, TerminalMode};
-use std::{
-    net::{IpAddr, Ipv4Addr, SocketAddr},
-    sync::Arc,
-};
 
 
 async fn start(executor: Arc<Executor<'_>>) -> Result<()> {
 async fn start(executor: Arc<Executor<'_>>) -> Result<()> {
     let rpc_addr = SocketAddr::new(IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)), 7777);
     let rpc_addr = SocketAddr::new(IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)), 7777);
@@ -67,19 +68,6 @@ async fn main() -> Result<()> {
         ColorChoice::Auto,
         ColorChoice::Auto,
     )?;
     )?;
 
 
-    let nthreads = num_cpus::get();
-    let (signal, shutdown) = async_channel::unbounded::<()>();
     let ex = Arc::new(Executor::new());
     let ex = Arc::new(Executor::new());
-    let ex3 = ex.clone();
-    let (_, result) = Parallel::new()
-        .each(0..nthreads, |_| smol::future::block_on(ex.run(shutdown.recv())))
-        .finish(|| {
-            smol::future::block_on(async move {
-                start(ex3.clone()).await?;
-                drop(signal);
-                Ok::<(), darkfi::Error>(())
-            })
-        });
-
-    result
+    smol::block_on(start(ex))
 }
 }