diff options
author | Nora Widdecke <nora@sequoia-pgp.org> | 2021-09-29 14:35:20 +0200 |
---|---|---|
committer | Nora Widdecke <nora@sequoia-pgp.org> | 2021-11-23 18:05:42 +0100 |
commit | 9e7701a47ab511d6a82d507db49554d4625cfcda (patch) | |
tree | edd428beb162e0c276f2da11380ebfb6279dd96b | |
parent | f0ab9cdb2017d8c03bc46fc28d38d4736ccdf248 (diff) |
store: Update to tokio 1.0.
-rw-r--r-- | Cargo.lock | 18 | ||||
-rw-r--r-- | store/Cargo.toml | 5 | ||||
-rw-r--r-- | store/src/backend/mod.rs | 2 | ||||
-rw-r--r-- | store/src/lib.rs | 6 |
4 files changed, 23 insertions, 8 deletions
@@ -2969,8 +2969,8 @@ dependencies = [ "sequoia-net", "sequoia-openpgp", "thiserror", - "tokio 0.2.25", - "tokio-util 0.3.1", + "tokio 1.12.0", + "tokio-util 0.6.8", ] [[package]] @@ -3119,6 +3119,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7fdf1b9db47230893d76faad238fd6097fd6d6a9245cd7a4d90dbd639536bbd2" [[package]] +name = "signal-hook-registry" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e51e73328dc4ac0c7ccbda3a494dfa03df1de2f46018127f60c693f2648455b0" +dependencies = [ + "libc", +] + +[[package]] name = "signature" version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -3546,7 +3555,11 @@ dependencies = [ "libc", "memchr", "mio 0.7.14", + "num_cpus", + "once_cell", + "parking_lot", "pin-project-lite 0.2.7", + "signal-hook-registry", "tokio-macros 1.5.0", "winapi 0.3.9", ] @@ -3606,6 +3619,7 @@ checksum = "08d3725d3efa29485e87311c5b699de63cde14b00ed4d256b8318aa30ca452cd" dependencies = [ "bytes 1.1.0", "futures-core", + "futures-io", "futures-sink", "log", "pin-project-lite 0.2.7", diff --git a/store/Cargo.toml b/store/Cargo.toml index df7076e4..29b40557 100644 --- a/store/Cargo.toml +++ b/store/Cargo.toml @@ -42,8 +42,9 @@ futures-util = "0.3.5" rand = { version = "0.7", default-features = false } rusqlite = "0.24" thiserror = "1.0.2" -tokio = { version = "0.2.19", features = ["rt-core", "tcp", "io-driver", "time"] } -tokio-util = { version = "0.3", features = ["compat"] } +#tokio = { version = "0.2.19", features = ["rt-core", "tcp", "io-driver", "time"] } +tokio = { version = "1", features = ["rt", "full"] } +tokio-util = { version = "0.6", features = ["compat"] } [target.'cfg(target_os="android")'.dependencies.rusqlite] version = "0.24.0" diff --git a/store/src/backend/mod.rs b/store/src/backend/mod.rs index 11f4b193..f3fe648a 100644 --- a/store/src/backend/mod.rs +++ b/store/src/backend/mod.rs @@ -943,7 +943,7 @@ impl KeyServer { let duration = Self::update(&c, net::Policy::Encrypted).await; let duration = duration.unwrap_or_else(|_| min_sleep_time()); - tokio::time::delay_for(random_duration(duration)).await; + tokio::time::sleep(random_duration(duration)).await; } } } diff --git a/store/src/lib.rs b/store/src/lib.rs index 962bce83..df16ecb7 100644 --- a/store/src/lib.rs +++ b/store/src/lib.rs @@ -123,14 +123,14 @@ impl Store { fn connect(c: &Context) -> Result<(RpcRuntime, node::Client)> { let descriptor = descriptor(c); - let rt = tokio::runtime::Builder::new() - .basic_scheduler() + let rt = tokio::runtime::Builder::new_current_thread() .enable_io() .enable_time() .build()?; // Need to enter Tokio context due to Tokio TcpStream creation binding // eagerly to an I/O reactor - let mut rpc_system = rt.enter(|| descriptor.connect())?; + let _guard = rt.enter(); + let mut rpc_system = descriptor.connect()?; let client: node::Client = rpc_system.bootstrap(Side::Server); |