Skip to content

Commit

Permalink
hyper 0.13 -> 0.14, tonic 0.2 -> 1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
amilkov3 committed Dec 26, 2020
1 parent 56bc5ef commit a804c95
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ license = "ISC"

[dependencies]
anyhow = "1.0"
futures-util = "0.3.1"
futures-util = "0.3"
hex = "0.4"
hyper = { version = "0.13", features = ["stream"] }
tokio = { version = "0.2", features = ["uds"] }
pin-project = "0.4"
hyper = { version = "0.14", features = ["full"] }
tokio = { version = "1.0", features = ["net", "rt-multi-thread"] }
pin-project = "1.0"
17 changes: 9 additions & 8 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ use pin_project::pin_project;
use std::borrow::Cow;
use std::future::Future;
use std::path::Path;
use tokio::io::ReadBuf;

/// A type which implements `Into` for hyper's [`hyper::Uri`] type
/// targetting unix domain sockets.
Expand Down Expand Up @@ -120,16 +121,14 @@ impl hyper::server::accept::Accept for UnixConnector {
type Error = Error;

fn poll_accept(
mut self: Pin<&mut Self>,
self: Pin<&mut Self>,
cx: &mut Context,
) -> Poll<Option<Result<Self::Conn, Self::Error>>> {
let fut = self
.0
.accept()
self.0
.poll_accept(cx)
.map_ok(|(stream, _addr)| stream)
.map_err(|e| e.into())
.map(|f| Some(f));
Future::poll(Box::pin(fut).as_mut(), cx)
.map(|f| Some(f))
}
}

Expand Down Expand Up @@ -160,7 +159,7 @@ macro_rules! conn_impl_fn {
}

impl tokio::io::AsyncRead for UDS {
conn_impl_fn!(poll_read |self: Pin<&mut Self>, cx: &mut Context<'_>, buf: &mut [u8]| -> Poll<std::io::Result<usize>> ;;);
conn_impl_fn!(poll_read |self: Pin<&mut Self>, cx: &mut Context<'_>, buf: &mut ReadBuf<'_>| -> Poll<std::io::Result<()>> ;;);
}

impl tokio::io::AsyncWrite for UDS {
Expand Down Expand Up @@ -235,7 +234,9 @@ mod test {

std::fs::remove_file(TEST_UNIX_ADDR).unwrap_or_else(|_| ());

let mut rt = tokio::runtime::Runtime::new()?;
let rt = tokio::runtime::Builder::new_multi_thread()
.enable_all()
.build()?;
rt.block_on(async {
// server
let uc: UnixConnector = tokio::net::UnixListener::bind(TEST_UNIX_ADDR)
Expand Down

0 comments on commit a804c95

Please sign in to comment.