Update to tokio 1.0 (#46)

* Update to tokio 1.0

* fix early data test
This commit is contained in:
nickelc 2020-12-23 22:42:03 +01:00 committed by GitHub
parent e40608bfeb
commit 44e978cfa6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 11 additions and 12 deletions

View File

@ -23,11 +23,11 @@ categories = ["asynchronous", "network-programming"]
[dependencies] [dependencies]
native-tls = "0.2" native-tls = "0.2"
tokio = "0.3" tokio = "1.0"
[dev-dependencies] [dev-dependencies]
tokio = { version = "0.3.0", features = ["macros", "stream", "rt", "rt-multi-thread", "io-util", "net"] } tokio = { version = "1.0", features = ["macros", "rt", "rt-multi-thread", "io-util", "net"] }
tokio-util = { version = "0.4.0", features = ["full"] } tokio-util = { version = "0.6.0", features = ["full"] }
cfg-if = "0.1" cfg-if = "0.1"
env_logger = { version = "0.6", default-features = false } env_logger = { version = "0.6", default-features = false }

View File

@ -12,7 +12,7 @@ categories = ["asynchronous", "cryptography", "network-programming"]
edition = "2018" edition = "2018"
[dependencies] [dependencies]
tokio = "0.3.5" tokio = "1.0"
rustls = "0.19" rustls = "0.19"
webpki = "0.21" webpki = "0.21"
@ -21,7 +21,7 @@ early-data = []
dangerous_configuration = ["rustls/dangerous_configuration"] dangerous_configuration = ["rustls/dangerous_configuration"]
[dev-dependencies] [dev-dependencies]
tokio = { version = "0.3.5", features = ["full"] } tokio = { version = "1.0", features = ["full"] }
futures-util = "0.3.1" futures-util = "0.3.1"
lazy_static = "1" lazy_static = "1"
webpki-roots = "0.21" webpki-roots = "0.21"

View File

@ -5,7 +5,7 @@ authors = ["quininer <quininer@live.com>"]
edition = "2018" edition = "2018"
[dependencies] [dependencies]
tokio = { version = "0.3", features = [ "full" ] } tokio = { version = "1.0", features = [ "full" ] }
argh = "0.1" argh = "0.1"
tokio-rustls = { path = "../.." } tokio-rustls = { path = "../.." }
webpki-roots = "0.21" webpki-roots = "0.21"

View File

@ -5,6 +5,6 @@ authors = ["quininer <quininer@live.com>"]
edition = "2018" edition = "2018"
[dependencies] [dependencies]
tokio = { version = "0.3", features = [ "full" ] } tokio = { version = "1.0", features = [ "full" ] }
argh = "0.1" argh = "0.1"
tokio-rustls = { path = "../.." } tokio-rustls = { path = "../.." }

View File

@ -2,8 +2,8 @@ use rustls::ClientConfig;
use std::io; use std::io;
use std::net::ToSocketAddrs; use std::net::ToSocketAddrs;
use std::sync::Arc; use std::sync::Arc;
use tokio::io::{AsyncReadExt, AsyncWriteExt};
use tokio::net::TcpStream; use tokio::net::TcpStream;
use tokio::prelude::*;
use tokio_rustls::{client::TlsStream, TlsConnector}; use tokio_rustls::{client::TlsStream, TlsConnector};
async fn get( async fn get(

View File

@ -9,9 +9,8 @@ use std::process::{Child, Command, Stdio};
use std::sync::Arc; use std::sync::Arc;
use std::task::{Context, Poll}; use std::task::{Context, Poll};
use std::time::Duration; use std::time::Duration;
use tokio::io::ReadBuf; use tokio::io::{AsyncRead, AsyncWriteExt, ReadBuf};
use tokio::net::TcpStream; use tokio::net::TcpStream;
use tokio::prelude::*;
use tokio::time::sleep; use tokio::time::sleep;
use tokio_rustls::{client::TlsStream, TlsConnector}; use tokio_rustls::{client::TlsStream, TlsConnector};
@ -45,6 +44,7 @@ async fn send(
// //
// see https://www.mail-archive.com/openssl-users@openssl.org/msg84451.html // see https://www.mail-archive.com/openssl-users@openssl.org/msg84451.html
let sleep1 = sleep(Duration::from_secs(1)); let sleep1 = sleep(Duration::from_secs(1));
futures_util::pin_mut!(sleep1);
let mut stream = match future::select(Read1(stream), sleep1).await { let mut stream = match future::select(Read1(stream), sleep1).await {
future::Either::Right((_, Read1(stream))) => stream, future::Either::Right((_, Read1(stream))) => stream,
future::Either::Left((Err(err), _)) => return Err(err), future::Either::Left((Err(err), _)) => return Err(err),

View File

@ -7,9 +7,8 @@ use std::net::SocketAddr;
use std::sync::mpsc::channel; use std::sync::mpsc::channel;
use std::sync::Arc; use std::sync::Arc;
use std::{io, thread}; use std::{io, thread};
use tokio::io::{copy, split}; use tokio::io::{copy, split, AsyncReadExt, AsyncWriteExt};
use tokio::net::{TcpListener, TcpStream}; use tokio::net::{TcpListener, TcpStream};
use tokio::prelude::*;
use tokio::runtime; use tokio::runtime;
use tokio_rustls::{TlsAcceptor, TlsConnector}; use tokio_rustls::{TlsAcceptor, TlsConnector};