Update 'hyper', 'tokio', and 'tokio-rustls'.

* hyper -> 0.13.0-alpha.2
* tokio -> 0.2.0-alpha.5
* tokio-rustls -> 0.12.0-alpha.3
This commit is contained in:
Jeb Rosen 2019-09-24 17:48:35 -07:00 committed by Sergio Benitez
parent af36f299c6
commit d1815e527f
3 changed files with 16 additions and 15 deletions

View File

@ -22,16 +22,17 @@ private-cookies = ["cookie/private", "cookie/key-expansion"]
[dependencies]
smallvec = "1.0"
percent-encoding = "1"
hyper = { version = "=0.13.0-alpha.1", default-features = false }
# TODO.async: stop using stream-unstable
hyper = { version = "=0.13.0-alpha.2", default-features = false, features = ["unstable-stream"] }
http = "0.1.17"
mime = "0.3.13"
time = "0.2.11"
indexmap = "1.0"
state = "0.4"
tokio-rustls = { version = "0.12.0-alpha.2", optional = true }
tokio-io = "=0.2.0-alpha.4"
tokio-net = "=0.2.0-alpha.4"
tokio-timer = "=0.3.0-alpha.4"
tokio-rustls = { version = "0.12.0-alpha.3", optional = true }
tokio-io = "=0.2.0-alpha.5"
tokio-net = "=0.2.0-alpha.5"
tokio-timer = "=0.3.0-alpha.5"
cookie = { version = "0.14.0", features = ["percent-encode"] }
pear = "0.1"
unicode-xid = "0.2"

View File

@ -6,8 +6,7 @@ use std::pin::Pin;
use std::task::{Context, Poll};
use std::time::{Duration, Instant};
use futures::ready;
use futures::stream::Stream;
use hyper::server::accept::Accept;
use log::{debug, error};
@ -35,8 +34,8 @@ pub trait Connection: AsyncRead + AsyncWrite {
/// This is a genericized version of hyper's AddrIncoming that is intended to be
/// usable with listeners other than a plain TCP stream, e.g. TLS and/or Unix
/// sockets. It does this by briding the `Listener` trait to what hyper wants (a
/// Stream of AsyncRead+AsyncWrite). This type is internal to Rocket.
/// sockets. It does this by bridging the `Listener` trait to what hyper wants
/// (an Accept). This type is internal to Rocket.
#[must_use = "streams do nothing unless polled"]
pub struct Incoming<L> {
listener: L,
@ -73,7 +72,7 @@ impl<L: Listener> Incoming<L> {
self.sleep_on_errors = val;
}
fn poll_next_(&mut self, cx: &mut Context<'_>) -> Poll<io::Result<L::Connection>> {
fn poll_next(&mut self, cx: &mut Context<'_>) -> Poll<io::Result<L::Connection>> {
// Check if a previous delay is active that was set by IO errors.
if let Some(ref mut delay) = self.pending_error_delay {
match Pin::new(delay).poll(cx) {
@ -124,11 +123,12 @@ impl<L: Listener> Incoming<L> {
}
}
impl<L: Listener + Unpin> Stream for Incoming<L> {
type Item = io::Result<L::Connection>;
impl<L: Listener + Unpin> Accept for Incoming<L> {
type Conn = L::Connection;
type Error = io::Error;
fn poll_next(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<Self::Item>> {
let result = ready!(self.poll_next_(cx));
fn poll_accept(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<Result<Self::Conn, Self::Error>>> {
let result = futures::ready!(self.poll_next(cx));
Poll::Ready(Some(result))
}
}

View File

@ -29,7 +29,7 @@ rocket_codegen = { version = "0.5.0-dev", path = "../codegen" }
rocket_http = { version = "0.5.0-dev", path = "../http" }
futures-preview = "0.3.0-alpha.18"
futures-tokio-compat = { git = "https://github.com/Nemo157/futures-tokio-compat", rev = "8a93702" }
tokio = "=0.2.0-alpha.4"
tokio = "=0.2.0-alpha.5"
yansi = "0.5"
log = { version = "0.4", features = ["std"] }
toml = "0.4.7"