Skip to content
This repository was archived by the owner on Dec 10, 2022. It is now read-only.

Commit d4e16b3

Browse files
author
Roman
authored
Merge pull request #27 from tox-rs/fix_thread_pool
Fix deprecated item 'tokio::executor::thread_pool'
2 parents 51ad2a9 + 91ffc35 commit d4e16b3

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/main.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ use futures::{future, Future, Sink, Stream};
2929
use futures::future::Either;
3030
use itertools::Itertools;
3131
use log::LevelFilter;
32-
use tokio::executor::thread_pool;
3332
use tokio::net::{TcpListener, UdpSocket, UdpFramed};
3433
use tokio::runtime;
3534
use tox::toxcore::crypto_core::*;
@@ -119,14 +118,13 @@ fn run<F>(future: F, threads_config: ThreadsConfig)
119118
let mut runtime = runtime::current_thread::Runtime::new().expect("Failed to create runtime");
120119
runtime.block_on(future).expect("Execution was terminated with error");
121120
} else {
122-
let mut threadpool_builder = thread_pool::Builder::new();
123-
threadpool_builder.name_prefix("tox-node-");
121+
let mut builder = runtime::Builder::new();
122+
builder.name_prefix("tox-node-");
124123
match threads_config {
125-
ThreadsConfig::N(n) => { threadpool_builder.pool_size(n as usize); },
124+
ThreadsConfig::N(n) => { builder.core_threads(n as usize); },
126125
ThreadsConfig::Auto => { }, // builder will detect number of cores automatically
127126
}
128-
let mut runtime = runtime::Builder::new()
129-
.threadpool_builder(threadpool_builder)
127+
let mut runtime = builder
130128
.build()
131129
.expect("Failed to create runtime");
132130
runtime.block_on(future).expect("Execution was terminated with error");

0 commit comments

Comments
 (0)