Upgrade to tokio 0.3. This breaks authentication because

reqwest does not support the tokio 0.3 runtime yet.
master
James T. Martin 2020-12-02 12:24:57 -08:00
parent e107ab8284
commit 0a0b9c3c25
Signed by: james
GPG Key ID: 4B7F3DA9351E577C
3 changed files with 73 additions and 32 deletions

93
Cargo.lock generated
View File

@ -119,6 +119,12 @@ version = "0.5.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0e4cec68f03f32e44924783795810fa50a7035d8c8ebe78580ad7e6c703fba38"
[[package]]
name = "bytes"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e0dcbc35f504eb6fc275a6d20e4ebcda18cf50d40ba6fabff8c711fa16cb3b16"
[[package]]
name = "cc"
version = "1.0.65"
@ -368,7 +374,7 @@ version = "0.2.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5e4728fd124914ad25e99e3d15a9361a879f6620f63cb56bbb08f95abb97a535"
dependencies = [
"bytes",
"bytes 0.5.6",
"fnv",
"futures-core",
"futures-sink",
@ -376,7 +382,7 @@ dependencies = [
"http",
"indexmap",
"slab",
"tokio",
"tokio 0.2.23",
"tokio-util",
"tracing",
"tracing-futures",
@ -403,7 +409,7 @@ version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "28d569972648b2c512421b5f2a405ad6ac9666547189d0c5477a3f200f3e02f9"
dependencies = [
"bytes",
"bytes 0.5.6",
"fnv",
"itoa",
]
@ -414,7 +420,7 @@ version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "13d5ff830006f7646652e057693569bfe0d51760c0085a071769d142a205111b"
dependencies = [
"bytes",
"bytes 0.5.6",
"http",
]
@ -436,7 +442,7 @@ version = "0.13.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f6ad767baac13b44d4529fcf58ba2cd0995e36e7b435bc5b039de6f47e880dbf"
dependencies = [
"bytes",
"bytes 0.5.6",
"futures-channel",
"futures-core",
"futures-util",
@ -448,7 +454,7 @@ dependencies = [
"itoa",
"pin-project 1.0.2",
"socket2",
"tokio",
"tokio 0.2.23",
"tower-service",
"tracing",
"want",
@ -460,10 +466,10 @@ version = "0.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d979acc56dcb5b8dddba3917601745e877576475aa046df3226eabdecef78eed"
dependencies = [
"bytes",
"bytes 0.5.6",
"hyper",
"native-tls",
"tokio",
"tokio 0.2.23",
"tokio-tls",
]
@ -609,21 +615,23 @@ dependencies = [
"kernel32-sys",
"libc",
"log",
"miow",
"miow 0.2.2",
"net2",
"slab",
"winapi 0.2.8",
]
[[package]]
name = "mio-uds"
version = "0.6.8"
name = "mio"
version = "0.7.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "afcb699eb26d4332647cc848492bbc15eafb26f08d0304550d5aa1f612e066f0"
checksum = "f33bc887064ef1fd66020c9adfc45bb9f33d75a42096c81e7c56c65b75dd1a8b"
dependencies = [
"iovec",
"libc",
"mio",
"log",
"miow 0.3.6",
"ntapi",
"winapi 0.3.9",
]
[[package]]
@ -638,6 +646,16 @@ dependencies = [
"ws2_32-sys",
]
[[package]]
name = "miow"
version = "0.3.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5a33c1b55807fbed163481b5ba66db4b2fa6cde694a5027be10fb724206c5897"
dependencies = [
"socket2",
"winapi 0.3.9",
]
[[package]]
name = "native-tls"
version = "0.2.6"
@ -667,6 +685,15 @@ dependencies = [
"winapi 0.3.9",
]
[[package]]
name = "ntapi"
version = "0.3.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3f6bb902e437b6d86e03cce10a7e2af662292c5dfef23b65899ea3ac9354ad44"
dependencies = [
"winapi 0.3.9",
]
[[package]]
name = "num-bigint"
version = "0.2.6"
@ -976,7 +1003,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fb15d6255c792356a0f578d8a645c677904dc02e862bebe2ecc18e0c01b9a0ce"
dependencies = [
"base64",
"bytes",
"bytes 0.5.6",
"encoding_rs",
"futures-core",
"futures-util",
@ -995,7 +1022,7 @@ dependencies = [
"pin-project-lite 0.2.0",
"serde",
"serde_urlencoded",
"tokio",
"tokio 0.2.23",
"tokio-tls",
"url",
"wasm-bindgen",
@ -1309,7 +1336,7 @@ dependencies = [
"serde_json",
"sha-1",
"take_mut",
"tokio",
"tokio 0.3.5",
"uuid",
]
@ -1319,26 +1346,40 @@ version = "0.2.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a6d7ad61edd59bfcc7e80dababf0f4aed2e6d5e0ba1659356ae889752dfc12ff"
dependencies = [
"bytes",
"bytes 0.5.6",
"fnv",
"futures-core",
"iovec",
"lazy_static",
"memchr",
"mio 0.6.23",
"pin-project-lite 0.1.11",
"slab",
]
[[package]]
name = "tokio"
version = "0.3.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a12a3eb39ee2c231be64487f1fcbe726c8f2514876a55480a5ab8559fc374252"
dependencies = [
"autocfg 1.0.1",
"bytes 0.6.0",
"lazy_static",
"libc",
"memchr",
"mio",
"mio-uds",
"mio 0.7.6",
"num_cpus",
"pin-project-lite 0.1.11",
"pin-project-lite 0.2.0",
"slab",
"tokio-macros",
]
[[package]]
name = "tokio-macros"
version = "0.2.6"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e44da00bfc73a25f814cd8d7e57a68a5c31b74b3152a0a1d1f590c97ed06265a"
checksum = "21d30fdbb5dc2d8f91049691aa1a9d4d4ae422a21c334ce8936e5886d30c5c45"
dependencies = [
"proc-macro2",
"quote",
@ -1352,7 +1393,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9a70f4fcd7b3b24fb194f837560168208f669ca8cb70d0c4b862944452396343"
dependencies = [
"native-tls",
"tokio",
"tokio 0.2.23",
]
[[package]]
@ -1361,12 +1402,12 @@ version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "be8242891f2b6cbef26a2d7e8605133c2c554cd35b3e4948ea892d6d68436499"
dependencies = [
"bytes",
"bytes 0.5.6",
"futures-core",
"futures-sink",
"log",
"pin-project-lite 0.1.11",
"tokio",
"tokio 0.2.23",
]
[[package]]

View File

@ -33,7 +33,7 @@ clap = { version = "2.33.1", features = ["yaml"] }
serde = { version = "1.0.117", features = ["derive"] }
serde_json = "1.0.59"
take_mut = "0.2.2"
tokio = { version = "0.2.22", features = ["io-util", "macros", "net", "tcp", "rt-threaded"] }
tokio = { version = "0.3.5", features = ["io-util", "macros", "net", "rt", "rt-multi-thread"] }
uuid = { version = "0.8.1", features = ["serde"] }
# Dependencies required for authentication

View File

@ -5,7 +5,7 @@ use cfb8::Cfb8;
use std::pin::Pin;
use std::task::Context;
use std::task::Poll;
use tokio::io::{AsyncRead, AsyncWrite, Result};
use tokio::io::{AsyncRead, AsyncWrite, ReadBuf, Result};
pub struct EncryptedStream {
rw: Box<dyn Stream>,
@ -46,13 +46,13 @@ impl EncryptedStream {
}
impl AsyncRead for EncryptedStream {
fn poll_read(self: Pin<&mut Self>, cx: &mut Context, buf: &mut [u8]) -> Poll<Result<usize>> {
fn poll_read(self: Pin<&mut Self>, cx: &mut Context, buf: &mut ReadBuf) -> Poll<Result<()>> {
let me = Pin::into_inner(self);
match Pin::new(&mut me.rw).poll_read(cx, buf) {
Poll::Ready(Ok(bytes)) => {
me.cipher.decrypt(&mut buf[..bytes]);
Poll::Ready(Ok(bytes))
Poll::Ready(Ok(())) => {
me.cipher.decrypt(buf.filled_mut());
Poll::Ready(Ok(()))
},
other => other,
}