Skip to content

Commit

Permalink
Merge pull request #235 from Emilgardis/upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
Emilgardis authored Feb 13, 2021
2 parents 76232da + 7a214ea commit 6292ca3
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 20 deletions.
30 changes: 15 additions & 15 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,48 +37,48 @@ async = [
log = { version = "0.4", optional = true, features = ["std"] }

# just the futures traits
futures-lite = { version = "1.8", optional = true }
futures-lite = { version = "1.11", optional = true }

# field pin projection
pin-project-lite = { version = "0.1", optional = true }
pin-project-lite = { version = "0.2", optional = true }

# cloneable async writes
async-dup = { version = "1.2", optional = true }

# message passing
async-channel = { version = "1.4", optional = true }
async-channel = { version = "1.5", optional = true }

# for timing out futures
futures-timer = { version = "3.0", optional = true }

# for 'fairness' in the main loop
fastrand = { version = "1.3", optional = true }
fastrand = { version = "1.4", optional = true }

# for optional serialization and deserialization
serde = { version = "1.0", features = ["derive"], optional = true }

# optional runtimes (for TcpStream)
# these use the futures AsyncWrite+AsyncRead
async-io = { version = "1.1", optional = true }
async-io = { version = "1.3", optional = true }
smol = { version = "1.2", optional = true }
async-tls = { version = "0.10", default-features = false, features = ["client"], optional = true }
async-tls = { version = "0.11", default-features = false, features = ["client"], optional = true }
# TODO look into what their features do. the ones they have enabled by default seem important
async-std = { version = "1.6", optional = true }
async-std = { version = "1.9", optional = true }

# tokio has its own AsyncWrite+AsyncRead
tokio = { version = "0.2", features = ["net"], optional = true }
tokio-util = { version = "0.3", features = ["compat"], optional = true }
tokio = { version = "1.2", features = ["net"], optional = true }
tokio-util = { version = "0.6", features = ["compat"], optional = true }

# rustls
tokio-rustls = { version = "0.14", optional = true }
webpki-roots = { version = "0.20", optional = true }
tokio-rustls = { version = "0.22", optional = true }
webpki-roots = { version = "0.21", optional = true }

# native-tls
tokio-native-tls = { version = "0.1", optional = true }
tokio-native-tls = { version = "0.3", optional = true }
native-tls = { version = "0.2", optional = true }

# openssl
tokio-openssl = { version = "0.4", optional = true }
tokio-openssl = { version = "0.6", optional = true }
openssl = { version = "0.10", optional = true, features = ["v110"] }

# for some test utilities
Expand All @@ -87,9 +87,9 @@ async-mutex = { version = "1.4", optional = true }

[dev-dependencies]
anyhow = "1.0"
async-executor = { version = "1.3", default-features = false }
async-executor = { version = "1.4", default-features = false }
serde_json = "1.0"
rmp-serde = "0.14"
rmp-serde = "0.15.4"

[[example]]
name = "message_parse"
Expand Down
2 changes: 1 addition & 1 deletion src/connector/tokio/native_tls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ impl crate::connector::Connector for ConnectorNativeTls {
let this = self.clone();

let fut = async move {
use tokio_util::compat::Tokio02AsyncReadCompatExt as _;
use tokio_util::compat::TokioAsyncReadCompatExt as _;

let connector: tokio_native_tls::TlsConnector = ::native_tls::TlsConnector::new()
.map_err(|err| std::io::Error::new(std::io::ErrorKind::Other, err))?
Expand Down
2 changes: 1 addition & 1 deletion src/connector/tokio/non_tls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ impl crate::connector::Connector for Connector {
fn connect(&mut self) -> BoxedFuture<std::io::Result<Self::Output>> {
let addrs = self.addrs.clone();
let fut = async move {
use tokio_util::compat::Tokio02AsyncReadCompatExt as _;
use tokio_util::compat::TokioAsyncReadCompatExt as _;
let stream = tokio::net::TcpStream::connect(&*addrs).await?;
Ok(async_dup::Mutex::new(stream.compat()))
};
Expand Down
8 changes: 6 additions & 2 deletions src/connector/tokio/openssl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,18 @@ impl crate::connector::Connector for ConnectorOpenSsl {
let this = self.clone();

let fut = async move {
use tokio_util::compat::Tokio02AsyncReadCompatExt as _;
use tokio_util::compat::TokioAsyncReadCompatExt as _;

let config = ::openssl::ssl::SslConnector::builder(::openssl::ssl::SslMethod::tls())
.and_then(|c| c.build().configure())
.map_err(|err| Error::new(ErrorKind::Other, err))?;

let stream = tokio::net::TcpStream::connect(&*this.addrs).await?;
let stream = tokio_openssl::connect(config, &this.tls_domain, stream)
let ssl = config.into_ssl(&this.tls_domain).map_err(|err| Error::new(ErrorKind::Other, err))?;
let mut stream = tokio_openssl::SslStream::new(ssl, stream)
.map_err(|err| Error::new(ErrorKind::Other, err))?;
std::pin::Pin::new(&mut stream)
.connect()
.await
.map_err(|err| Error::new(ErrorKind::Other, err))?;

Expand Down
2 changes: 1 addition & 1 deletion src/connector/tokio/rustls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ impl crate::connector::Connector for ConnectorRustTls {
fn connect(&mut self) -> BoxedFuture<std::io::Result<Self::Output>> {
let this = self.clone();
let fut = async move {
use tokio_util::compat::Tokio02AsyncReadCompatExt as _;
use tokio_util::compat::TokioAsyncReadCompatExt as _;
let domain = tokio_rustls::webpki::DNSNameRef::try_from_ascii_str(&this.tls_domain)
.map_err(|err| std::io::Error::new(std::io::ErrorKind::Other, err))?;

Expand Down

0 comments on commit 6292ca3

Please sign in to comment.