Skip to content

Commit e558999

Browse files
committed
Bump to latest hyper, tokio, and futures pre-releases
1 parent 23df89e commit e558999

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
@@ -80,17 +80,17 @@ conduit-hyper = { git = "https://github.com/jtgeibel/conduit-hyper", branch="asy
8080
futures-preview = { version = "0.3.0-alpha.19", features = ["compat", "async-await"] }
8181
tokio = { version = "0.2.0-alpha.2", default-features = false, features = ["tcp", "fs"]}
8282
tokio-net = { version = "0.2.0-alpha.2", default-features=false, features = ["signal"] }
83-
hyper = { git = "https://github.com/hyperium/hyper" }
83+
hyper = "0.13.0-alpha.4"
8484
ctrlc = { version = "3.0", features = ["termination"] }
8585
indexmap = "1.0.2"
8686
handlebars = "2.0.1"
8787

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

9595
[build-dependencies]
9696
dotenv = "0.15"

src/bin/server.rs

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

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

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

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

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

7979
let server = server.with_graceful_shutdown(async move {
8080
// 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)