Skip to content

Commit 6bc11cf

Browse files
authored
Updates due to nightly changes (#6)
1 parent ced1300 commit 6bc11cf

File tree

6 files changed

+50
-50
lines changed

6 files changed

+50
-50
lines changed

Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@ edition = "2018"
77
# - Update CHANGELOG.md.
88
# - Update doc URL.
99
# - Create "v0.1.x" git tag.
10-
version = "0.3.0-alpha.5"
10+
version = "0.3.0-alpha.6"
1111
license = "MIT"
1212
readme = "README.md"
1313
description = """
1414
TLS support for AsyncRead/AsyncWrite using native-tls
1515
"""
1616
authors = ["Danny Browning <[email protected]>", "Carl Lerche <[email protected]>"]
1717
categories = ["asynchronous", "network-programming"]
18-
documentation = "https://docs.rs/tls-async/0.3.0-alpha.5/tls_async/"
18+
documentation = "https://docs.rs/tls-async/"
1919
repository = "https://github.com/dbcfd/tls-async"
2020

2121
[dependencies]
@@ -25,13 +25,13 @@ log = "0.4.1"
2525
native-tls = "0.2"
2626

2727
[dependencies.futures]
28-
version = "0.3.0-alpha.14"
28+
version = "0.3.0-alpha.16"
2929
package = "futures-preview"
3030
features = ["compat", "io-compat", "std"]
3131

3232
[dev-dependencies]
3333
cfg-if = "0.1"
34-
romio = "0.3.0-alpha.5"
34+
romio = "0.3.0-alpha.8"
3535
tokio = "0.1"
3636

3737
[dev-dependencies.env_logger]

examples/echo.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![feature(async_await, await_macro, futures_api)]
1+
#![feature(async_await)]
22
// A tiny async TLS echo server with Tokio
33
use futures::{FutureExt, TryFutureExt, StreamExt};
44
use futures::io::AsyncReadExt;
@@ -18,16 +18,16 @@ async fn accept_connections() -> () {
1818

1919
// Iterate incoming connections
2020
let mut tcp_incoming = tcp.incoming();
21-
while let Some(tcp) = await!(tcp_incoming.next()) {
21+
while let Some(tcp) = tcp_incoming.next().await {
2222
let tcp = tcp.expect("Error encountered while fetching next");
2323
let tcp = tls_acceptor.accept(tcp);
2424
let tls = async {
25-
let tls = await!(tcp).expect("Failed to form tls connection");
25+
let tls = tcp.await.expect("Failed to form tls connection");
2626
// Split up the read and write halves
2727
let (mut reader, mut writer) = tls.split();
2828

2929
// Copy the data back to the client
30-
match await!(reader.copy_into(&mut writer)) {
30+
match reader.copy_into(&mut writer).await {
3131
Ok(n) => println!("wrote {} bytes", n),
3232
Err(err) => println!("IO error {:?}", err)
3333
}

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
//! functionality provided by the `native-tls` crate, on which this crate is
1515
//! built. Configuration of TLS parameters is still primarily done through the
1616
//! `native-tls` crate.
17-
#![feature(async_await, await_macro)]
17+
#![feature(async_await)]
1818
mod acceptor;
1919
mod connector;
2020
mod errors;

tests/bad.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![feature(async_await, await_macro)]
1+
#![feature(async_await)]
22
use std::net::ToSocketAddrs;
33

44
use cfg_if::cfg_if;
@@ -87,17 +87,17 @@ async fn get_host(host: String) -> Result<(), Error> {
8787
let addr = format!("{}:443", host);
8888
let addr = t!(addr.to_socket_addrs()).next().unwrap();
8989

90-
let socket = t!(await!(TcpStream::connect(&addr)));
90+
let socket = t!(TcpStream::connect(&addr).await);
9191
let builder = TlsConnector::builder();
9292
let cx = t!(builder.build());
93-
await!(cx.connect(&host, socket))?;
93+
cx.connect(&host, socket).await?;
9494
Ok(())
9595
}
9696

9797
#[test]
9898
fn expired() {
9999
let fut_res = async {
100-
await!(get_host("expired.badssl.com".to_owned()))
100+
get_host("expired.badssl.com".to_owned()).await
101101
};
102102
let mut rt = t!(tokio::runtime::Runtime::new());
103103
let res = rt.block_on(fut_res.boxed().compat());
@@ -112,7 +112,7 @@ fn expired() {
112112
#[cfg_attr(all(target_os = "macos", feature = "force-openssl"), ignore)]
113113
fn wrong_host() {
114114
let fut_res = async {
115-
await!(get_host("wrong.host.badssl.com".to_owned()))
115+
get_host("wrong.host.badssl.com".to_owned()).await
116116
};
117117
let mut rt = t!(tokio::runtime::Runtime::new());
118118
let res = rt.block_on(fut_res.boxed().compat());
@@ -124,7 +124,7 @@ fn wrong_host() {
124124
#[test]
125125
fn self_signed() {
126126
let fut_res = async {
127-
await!(get_host("self-signed.badssl.com".to_owned()))
127+
get_host("self-signed.badssl.com".to_owned()).await
128128
};
129129
let mut rt = t!(tokio::runtime::Runtime::new());
130130
let res = rt.block_on(fut_res.boxed().compat());
@@ -136,7 +136,7 @@ fn self_signed() {
136136
#[test]
137137
fn untrusted_root() {
138138
let fut_res = async {
139-
await!(get_host("untrusted-root.badssl.com".to_owned()))
139+
get_host("untrusted-root.badssl.com".to_owned()).await
140140
};
141141
let mut rt = t!(tokio::runtime::Runtime::new());
142142
let res = rt.block_on(fut_res.boxed().compat());

tests/google.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![feature(async_await, await_macro)]
1+
#![feature(async_await)]
22
use std::net::ToSocketAddrs;
33

44
use cfg_if::cfg_if;
@@ -58,7 +58,7 @@ fn fetch_google() {
5858
// First up, resolve google.com
5959
let addr = t!("google.com:443".to_socket_addrs()).next().unwrap();
6060

61-
let socket = t!(await!(TcpStream::connect(&addr)));
61+
let socket = t!(TcpStream::connect(&addr).await);
6262

6363
println!("Connected to google");
6464

@@ -69,12 +69,12 @@ fn fetch_google() {
6969

7070
println!("Attempting tls connection");
7171

72-
let mut stream = t!(await!(connector.connect("google.com", socket)));
73-
t!(await!(stream.write_all(b"GET / HTTP/1.0\r\n\r\n")));
74-
t!(await!(stream.flush()));
72+
let mut stream = t!(connector.connect("google.com", socket).await);
73+
t!(stream.write_all(b"GET / HTTP/1.0\r\n\r\n").await);
74+
t!(stream.flush().await);
7575
let mut buf = vec![];
76-
t!(await!(stream.read_to_end(&mut buf)));
77-
t!(await!(stream.close()));
76+
t!(stream.read_to_end(&mut buf).await);
77+
t!(stream.close().await);
7878
buf
7979
};
8080

@@ -99,10 +99,10 @@ fn wrong_hostname_error() {
9999

100100
let fut_result = async {
101101
let addr = t!("google.com:443".to_socket_addrs()).next().unwrap();
102-
let socket = t!(await!(TcpStream::connect(&addr)));
102+
let socket = t!(TcpStream::connect(&addr).await);
103103
let builder = TlsConnector::builder();
104104
let connector = t!(builder.build());
105-
await!(connector.connect("rust-lang.org", socket))
105+
connector.connect("rust-lang.org", socket).await
106106
};
107107

108108
let mut rt = t!(tokio::runtime::Runtime::new());

tests/smoke.rs

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![feature(async_await, await_macro)]
1+
#![feature(async_await)]
22
use std::io::Write;
33
use std::process::Command;
44

@@ -495,22 +495,22 @@ fn client_to_server() {
495495
// read all the data from it.
496496
let fut_server = async move {
497497
let mut incoming = srv.incoming();
498-
let socket = t!(await!(incoming.next()).unwrap());
498+
let socket = t!(incoming.next().await.unwrap());
499499
let f = server_cx.accept(socket);
500-
let mut stream = t!(await!(f));
500+
let mut stream = t!(f.await);
501501
let mut buf = vec![];
502-
t!(await!(stream.read_to_end(&mut buf)));
502+
t!(stream.read_to_end(&mut buf).await);
503503
buf
504504
};
505505

506506
let fut_client = async move {
507507
// Create a future to connect to our server, connect the ssl stream, and
508508
// then write a bunch of data to it.
509-
let socket = t!(await!(TcpStream::connect(&addr)));
510-
let mut socket = t!(await!(client_cx.connect("localhost", socket)));
511-
t!(await!(socket.write_all(&EXPECTED)));
512-
t!(await!(socket.flush()));
513-
t!(await!(socket.close()));
509+
let socket = t!(TcpStream::connect(&addr).await);
510+
let mut socket = t!(client_cx.connect("localhost", socket).await);
511+
t!(socket.write_all(&EXPECTED).await);
512+
t!(socket.flush().await);
513+
t!(socket.close().await);
514514
};
515515

516516
// Finally, run everything!
@@ -532,18 +532,18 @@ fn server_to_client() {
532532

533533
let fut_server = async move {
534534
let mut incoming = srv.incoming();
535-
let socket = t!(await!(incoming.next()).unwrap());
536-
let mut socket = t!(await!(server_cx.accept(socket)));
537-
t!(await!(socket.write_all(&EXPECTED)));
538-
t!(await!(socket.flush()));
539-
t!(await!(socket.close()));
535+
let socket = t!(incoming.next().await.unwrap());
536+
let mut socket = t!(server_cx.accept(socket).await);
537+
t!(socket.write_all(&EXPECTED).await);
538+
t!(socket.flush().await);
539+
t!(socket.close().await);
540540
};
541541

542542
let fut_client = async move {
543-
let socket = t!(await!(TcpStream::connect(&addr)));
544-
let mut stream = t!(await!(client_cx.connect("localhost", socket)));
543+
let socket = t!(TcpStream::connect(&addr).await);
544+
let mut stream = t!(client_cx.connect("localhost", socket).await);
545545
let mut buf = vec![];
546-
t!(await!(stream.read_to_end(&mut buf)));
546+
t!(stream.read_to_end(&mut buf).await);
547547
buf
548548
};
549549

@@ -565,21 +565,21 @@ fn one_byte_at_a_time() {
565565

566566
let fut_server = async move {
567567
let mut incoming = srv.incoming();
568-
let socket = t!(await!(incoming.next()).unwrap());
569-
let mut stream = t!(await!(server_cx.accept(socket)));
568+
let socket = t!(incoming.next().await.unwrap());
569+
let mut stream = t!(server_cx.accept(socket).await);
570570
for byte in SMALL_EXPECTED.iter().cloned() {
571571
let to_send = [byte];
572-
t!(await!(stream.write_all(&to_send)));
573-
t!(await!(stream.flush()));
572+
t!(stream.write_all(&to_send).await);
573+
t!(stream.flush().await);
574574
}
575-
t!(await!(stream.close()));
575+
t!(stream.close().await);
576576
};
577577

578578
let fut_client = async move {
579-
let socket = t!(await!(TcpStream::connect(&addr)));
580-
let mut stream = t!(await!(client_cx.connect("localhost", socket)));
579+
let socket = t!(TcpStream::connect(&addr).await);
580+
let mut stream = t!(client_cx.connect("localhost", socket).await);
581581
let mut buf = vec![];
582-
t!(await!(stream.read_to_end(&mut buf)));
582+
t!(stream.read_to_end(&mut buf).await);
583583
buf
584584
};
585585

0 commit comments

Comments
 (0)