Skip to content

Commit

Permalink
Bumped prost, prost-build, prost-types, tonic, tonic-build,…
Browse files Browse the repository at this point in the history
… `tower` versions. Added `hyper-utils` (hyperium/hyper#3110)
  • Loading branch information
clovexx committed Jul 29, 2024
1 parent 369a73f commit 01204ac
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 20 deletions.
12 changes: 6 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@ nix = "0.28"
oci-spec = "0.6"
os_pipe = "1.1"
prctl = "1.0.0"
prost = "0.12"
prost-build = "0.12"
prost-types = "0.12"
prost = "0.13.1"
prost-build = "0.13.1"
prost-types = "0.13.1"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
thiserror = "1.0"
time = { version = "0.3.29", features = ["serde", "std", "formatting"] }
tokio = "1.26"
tonic = "0.11"
tonic-build = "0.11"
tower = "0.4"
tonic = "0.12"
tonic-build = "0.12"
tower = "0.4.13"
uuid = { version = "1.0", features = ["v4"] }
1 change: 1 addition & 0 deletions crates/client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ prost-types.workspace = true
tokio = { workspace = true, optional = true }
tonic.workspace = true
tower = { workspace = true, optional = true }
hyper-util = "0.1.6" # https://github.com/hyperium/hyper/issues/3110

[build-dependencies]
tonic-build.workspace = true
Expand Down
31 changes: 17 additions & 14 deletions crates/client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,23 +86,26 @@ pub async fn connect(

let path = path.as_ref().to_path_buf();

// Taken from https://github.com/hyperium/tonic/blob/eeb3268f71ae5d1107c937392389db63d8f721fb/examples/src/uds/client.rs#L19
// Taken from https://github.com/hyperium/tonic/blob/71fca362d7ffbb230547f23b3f2fb75c414063a8/examples/src/uds/client.rs#L21-L28
// There will ignore this uri because uds do not use it
// and make connection with UnixStream::connect.
let channel = Endpoint::try_from("http://[::]")
.unwrap()
let channel = Endpoint::try_from("http://[::]")?
.connect_with_connector(tower::service_fn(move |_| {
#[cfg(unix)]
{
tokio::net::UnixStream::connect(path.clone())
}

#[cfg(windows)]
{
let client = tokio::net::windows::named_pipe::ClientOptions::new()
.open(path.clone())
.map_err(|e| std::io::Error::from(e));
async move { client }
let path = path.clone();

async move {
#[cfg(unix)]
{
Ok::<_, std::io::Error>(hyper_util::rt::TokioIo::new(tokio::net::UnixStream::connect(path).await?))
}

#[cfg(windows)]
{
let client = tokio::net::windows::named_pipe::ClientOptions::new()
.open(path)
.map_err(|e| std::io::Error::from(e));
client.await
}
}
}))
.await?;
Expand Down

0 comments on commit 01204ac

Please sign in to comment.