Update to tokio 1.0

pull/74/head
Constantin Nickel 4 years ago committed by Sebastian Dröge
parent 7f145a5661
commit 253f8c9291
  1. 9
      Cargo.toml
  2. 2
      examples/tokio-echo.rs
  3. 9
      src/tokio/openssl.rs

@ -42,7 +42,7 @@ version = "1.0"
[dependencies.real-tokio-openssl]
optional = true
version = "0.5"
version = "0.6"
package = "tokio-openssl"
[dependencies.openssl]
@ -66,17 +66,17 @@ package = "native-tls"
[dependencies.tokio]
optional = true
version = "0.3"
version = "1.0"
features = ["net"]
[dependencies.real-tokio-native-tls]
optional = true
version = "0.2"
version = "0.3"
package = "tokio-native-tls"
[dependencies.real-tokio-rustls]
optional = true
version = "^0.20"
version = "^0.22"
package = "tokio-rustls"
[dependencies.webpki-roots]
@ -96,6 +96,7 @@ futures = "0.3"
url = "2.0.0"
env_logger = "0.8"
async-std = { version = "1.0", features = ["attributes", "unstable"] }
tokio = { version = "1.0", features = ["full"] }
[[example]]
name = "autobahn-client"

@ -33,6 +33,6 @@ async fn run() -> Result<(), Box<dyn std::error::Error>> {
}
fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut rt = tokio::runtime::Runtime::new()?;
let rt = tokio::runtime::Runtime::new()?;
rt.block_on(run())
}

@ -1,5 +1,4 @@
use openssl::ssl::{ConnectConfiguration, SslConnector, SslMethod};
use real_tokio_openssl::connect;
use real_tokio_openssl::SslStream as TlsStream;
use tungstenite::client::{uri_mode, IntoClientRequest};
@ -47,8 +46,12 @@ where
.configure()
.map_err(|err| std::io::Error::new(std::io::ErrorKind::Other, err))?
};
connect(connector, &domain, socket)
.await
let ssl = connector
.into_ssl(&domain)
.map_err(|err| std::io::Error::new(std::io::ErrorKind::Other, err))?;
TlsStream::new(ssl, socket)
.map_err(|err| std::io::Error::new(std::io::ErrorKind::Other, err))?
};
Ok(StreamSwitcher::Tls(TokioAdapter(stream)))

Loading…
Cancel
Save