]> git.bitcoin.ninja Git - dnsseed-rust/commitdiff
Use more threads to avoid locks blocking all progress
authorMatt Corallo <git@bluematt.me>
Sun, 26 May 2019 18:03:35 +0000 (14:03 -0400)
committerMatt Corallo <git@bluematt.me>
Sun, 26 May 2019 18:03:35 +0000 (14:03 -0400)
Cargo.toml
src/main.rs

index 95bc9b56adc3e54c98451fac38a7b74d69e6acd1..fb03cb5e59e25e28c8db341226024e26738310ce 100644 (file)
@@ -12,6 +12,7 @@ bytes = "0.4"
 futures = "0.1"
 rand = "0.6"
 regex = "1"
+num_cpus = "1"
 
 [profile.release]
 lto = true
index cefbbc1bac1e081a478a7c97a9ec1f92c6df4b78..7495d17229e035563702b458eda097416770acfb 100644 (file)
@@ -356,7 +356,11 @@ fn main() {
        unsafe { HIGHEST_HEADER = Some(Box::new(Mutex::new((genesis_block(Network::Bitcoin).bitcoin_hash(), 0)))) };
        unsafe { REQUEST_BLOCK = Some(Box::new(Mutex::new(Arc::new((0, genesis_block(Network::Bitcoin).bitcoin_hash(), genesis_block(Network::Bitcoin)))))) };
 
-       tokio::run(future::lazy(|| {
+       let trt = tokio::runtime::Builder::new()
+               .blocking_threads(2).core_threads(num_cpus::get().max(1) * 3)
+               .build().unwrap();
+
+       let _ = trt.block_on_all(future::lazy(|| {
                let mut args = env::args();
                args.next();
                let path = args.next().unwrap();