Skip to content

hyper 0.13 -> 0.14, tonic 0.2 -> 1.0 #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 26, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"] }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we really need features = ["full"]?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I created pull request with removing not required features: #4

tokio = { version = "1.0", features = ["net", "rt-multi-thread"] }
pin-project = "1.0"
18 changes: 9 additions & 9 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ use core::{
pin::Pin,
task::{Context, Poll},
};
use futures_util::future::{FutureExt, TryFutureExt};
use hex::FromHex;
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 +120,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 +158,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 +233,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