From b876fb84ba74178443741ac9279105bd2453c2ff Mon Sep 17 00:00:00 2001 From: Michael Vines Date: Thu, 23 Jul 2020 08:35:23 -0700 Subject: [PATCH] Make room for tokio 0.2 --- core/Cargo.toml | 7 +++---- core/src/rpc_service.rs | 8 +++++--- core/src/rpc_subscriptions.rs | 4 +++- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/core/Cargo.toml b/core/Cargo.toml index f23a74775..8796c1b3d 100644 --- a/core/Cargo.toml +++ b/core/Cargo.toml @@ -70,10 +70,9 @@ solana-vote-signer = { path = "../vote-signer", version = "1.4.0" } spl-token-v1-0 = { package = "spl-token", version = "1.0.6", features = ["skip-no-mangle"] } tempfile = "3.1.0" thiserror = "1.0" -tokio = "0.1" -tokio-codec = "0.1" -tokio-fs = "0.1" -tokio-io = "0.1" +tokio_01 = { version = "0.1", package = "tokio" } +tokio_fs_01 = { version = "0.1", package = "tokio-fs" } +tokio_io_01 = { version = "0.1", package = "tokio-io" } solana-rayon-threadlimit = { path = "../rayon-threadlimit", version = "1.4.0" } trees = "0.2.1" diff --git a/core/src/rpc_service.rs b/core/src/rpc_service.rs index 820f3f51e..009d5f560 100644 --- a/core/src/rpc_service.rs +++ b/core/src/rpc_service.rs @@ -23,7 +23,6 @@ use std::{ sync::{mpsc::channel, Arc, RwLock}, thread::{self, Builder, JoinHandle}, }; -use tokio::prelude::Future; pub struct JsonRpcService { thread_hdl: JoinHandle<()>, @@ -97,6 +96,9 @@ impl RpcRequestMiddleware { } fn process_file_get(&self, path: &str) -> RequestMiddlewareAction { + // Stuck on tokio 0.1 until the jsonrpc-http-server crate upgrades to tokio 0.2 + use tokio_01::prelude::*; + let stem = path.split_at(1).1; // Drop leading '/' from path let filename = { match path { @@ -115,10 +117,10 @@ impl RpcRequestMiddleware { RequestMiddlewareAction::Respond { should_validate_hosts: true, response: Box::new( - tokio_fs::file::File::open(filename) + tokio_fs_01::file::File::open(filename) .and_then(|file| { let buf: Vec = Vec::new(); - tokio_io::io::read_to_end(file, buf) + tokio_io_01::io::read_to_end(file, buf) .and_then(|item| Ok(hyper::Response::new(item.1.into()))) .or_else(|_| Ok(RpcRequestMiddleware::internal_server_error())) }) diff --git a/core/src/rpc_subscriptions.rs b/core/src/rpc_subscriptions.rs index b4b1c9dbb..23f251cb8 100644 --- a/core/src/rpc_subscriptions.rs +++ b/core/src/rpc_subscriptions.rs @@ -38,7 +38,9 @@ use std::{ iter, sync::{Arc, Mutex, RwLock}, }; -use tokio::runtime::{Builder as RuntimeBuilder, Runtime, TaskExecutor}; + +// Stuck on tokio 0.1 until the jsonrpc-pubsub crate upgrades to tokio 0.2 +use tokio_01::runtime::{Builder as RuntimeBuilder, Runtime, TaskExecutor}; const RECEIVE_DELAY_MILLIS: u64 = 100;