mirror of
https://github.com/darkrenaissance/darkfi.git
synced 2026-04-28 03:00:18 -04:00
bin/taud: minor changes & clean up
This commit is contained in:
1
Cargo.lock
generated
1
Cargo.lock
generated
@@ -5302,7 +5302,6 @@ dependencies = [
|
||||
"async-std",
|
||||
"async-trait",
|
||||
"darkfi",
|
||||
"easy-parallel",
|
||||
"futures",
|
||||
"log",
|
||||
"num_cpus",
|
||||
|
||||
@@ -17,7 +17,6 @@ async-std = {version = "1.10.0", features = ["attributes"]}
|
||||
async-trait = "0.1.52"
|
||||
async-channel = "1.6.1"
|
||||
async-executor = "1.4.1"
|
||||
easy-parallel = "3.2.0"
|
||||
|
||||
# Misc
|
||||
log = "0.4.14"
|
||||
|
||||
@@ -1,5 +1,14 @@
|
||||
use std::{
|
||||
net::{IpAddr, Ipv4Addr, SocketAddr},
|
||||
sync::Arc,
|
||||
};
|
||||
|
||||
use async_executor::Executor;
|
||||
use async_trait::async_trait;
|
||||
use log::debug;
|
||||
use serde_json::{json, Value};
|
||||
use simplelog::{ColorChoice, LevelFilter, TermLogger, TerminalMode};
|
||||
|
||||
use darkfi::{
|
||||
rpc::{
|
||||
jsonrpc::{error as jsonerr, response as jsonresp, ErrorCode::*, JsonRequest, JsonResult},
|
||||
@@ -7,14 +16,6 @@ use darkfi::{
|
||||
},
|
||||
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<()> {
|
||||
let rpc_addr = SocketAddr::new(IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)), 7777);
|
||||
@@ -67,19 +68,6 @@ async fn main() -> Result<()> {
|
||||
ColorChoice::Auto,
|
||||
)?;
|
||||
|
||||
let nthreads = num_cpus::get();
|
||||
let (signal, shutdown) = async_channel::unbounded::<()>();
|
||||
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))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user