Skip to content

Commit 8d3427f

Browse files
committed
Bump to latest hyper, tokio, and futures pre-releases
1 parent d501f35 commit 8d3427f

File tree

4 files changed

+21
-47
lines changed

4 files changed

+21
-47
lines changed

Cargo.lock

Lines changed: 4 additions & 34 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,17 +81,17 @@ conduit-hyper = { git = "https://github.com/jtgeibel/conduit-hyper", branch="asy
8181
futures-preview = { version = "0.3.0-alpha.19", features = ["compat", "async-await"] }
8282
tokio = { version = "0.2.0-alpha.2", default-features = false, features = ["tcp", "fs"]}
8383
tokio-net = { version = "0.2.0-alpha.2", default-features=false, features = ["signal"] }
84-
hyper = { git = "https://github.com/hyperium/hyper" }
84+
hyper = "0.13.0-alpha.4"
8585
ctrlc = { version = "3.0", features = ["termination"] }
8686
indexmap = "1.0.2"
8787
handlebars = "2.0.1"
8888

8989
[dev-dependencies]
9090
conduit-test = "0.8"
91-
hyper-tls = { git = "https://github.com/hyperium/hyper-tls" }
91+
hyper-tls = "0.4.0-alpha.4"
9292
lazy_static = "1.0"
9393
diesel_migrations = { version = "1.3.0", features = ["postgres"] }
94-
tower-service = "0.3.0-alpha.1"
94+
tower-service = "0.3.0-alpha.2"
9595

9696
[build-dependencies]
9797
dotenv = "0.11"

src/bin/server.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
5959

6060
let server = if dotenv::var("USE_HYPER").is_ok() {
6161
use tokio::io::AsyncWriteExt;
62-
use tokio_net::signal::unix::{Signal, SignalKind};
62+
use tokio_net::signal::unix::{signal, SignalKind};
6363

6464
println!("Booting with a hyper based server");
6565

@@ -74,8 +74,8 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
7474
let addr = ([127, 0, 0, 1], port).into();
7575
let server = hyper::Server::bind(&addr).serve(make_service);
7676

77-
let mut sig_int = Signal::new(SignalKind::interrupt())?.into_future();
78-
let mut sig_term = Signal::new(SignalKind::terminate())?.into_future();
77+
let mut sig_int = signal(SignalKind::interrupt())?.into_future();
78+
let mut sig_term = signal(SignalKind::terminate())?.into_future();
7979

8080
let server = server.with_graceful_shutdown(async move {
8181
// Wait for either signal

src/tests/record.rs

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use std::{
88
path::PathBuf,
99
pin::Pin,
1010
str,
11-
sync::{Arc, Mutex, Once},
11+
sync::{mpsc, Arc, Mutex, Once},
1212
task::{Context, Poll},
1313
thread,
1414
};
@@ -86,9 +86,7 @@ pub fn proxy() -> (String, Bomb) {
8686
let me = thread::current().name().unwrap().to_string();
8787
let record = dotenv::var("RECORD").is_ok();
8888

89-
let addr = "127.0.0.1:0".parse().unwrap();
90-
let listener = t!(TcpListener::bind(&addr));
91-
let ret = format!("http://{}", t!(listener.local_addr()));
89+
let (url_tx, url_rx) = mpsc::channel();
9290

9391
let data = cache_file(&me.replace("::", "_"));
9492
let record = if record && !data.exists() {
@@ -108,14 +106,20 @@ pub fn proxy() -> (String, Bomb) {
108106

109107
let thread = thread::spawn(move || {
110108
let mut rt = t!(Runtime::new());
109+
111110
let client = if let Record::Capture(_, _) = record {
112-
Some(hyper::Client::builder().build(hyper_tls::HttpsConnector::new(4).unwrap()))
111+
Some(hyper::Client::builder().build(hyper_tls::HttpsConnector::new().unwrap()))
113112
} else {
114113
None
115114
};
116115

116+
let listener = t!(rt.block_on(TcpListener::bind("127.0.0.1:0")));
117+
url_tx
118+
.send(format!("http://{}", t!(listener.local_addr())))
119+
.unwrap();
120+
117121
let record = Arc::new(Mutex::new(record));
118-
let srv = Server::builder(listener.incoming())
122+
let srv = Server::builder(hyper::server::accept::from_stream(listener.incoming()))
119123
.serve(Proxy {
120124
sink: sink2,
121125
record: Arc::clone(&record),
@@ -138,7 +142,7 @@ pub fn proxy() -> (String, Bomb) {
138142
});
139143

140144
(
141-
ret,
145+
url_rx.recv().unwrap(),
142146
Bomb {
143147
iorx: Sink(sink),
144148
quittx: Some(quittx),

0 commit comments

Comments
 (0)