chore(deps): update NamedPipes related deps (#336)

This commit is contained in:
Santiago Carmuega 2023-11-20 08:28:35 -03:00 committed by GitHub
parent 9b57b0f53d
commit 7d0de0b494
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 24 deletions

View file

@ -8,10 +8,7 @@ homepage = "https://github.com/txpipe/pallas"
documentation = "https://docs.rs/pallas-upstream"
license = "Apache-2.0"
readme = "README.md"
authors = [
"Santiago Carmuega <santiago@carmuega.me>",
"Pi Lanningham <pi.lanningham@gmail.com>",
]
authors = ["Santiago Carmuega <santiago@carmuega.me>", "Pi Lanningham <pi.lanningham@gmail.com>"]
[dependencies]
byteorder = "1.4.3"
@ -23,10 +20,6 @@ thiserror = "1.0.31"
tokio = { version = "1", features = ["net", "io-util", "time", "sync", "macros"] }
tracing = "0.1.37"
[target.'cfg(windows)'.dependencies]
tokio-named-pipes = "0.1.0"
windows-sys = "0.48.0"
[dev-dependencies]
tracing-subscriber = "0.3.16"
tokio = { version = "1", features = ["full"] }

View file

@ -103,22 +103,7 @@ impl Bearer {
pub async fn connect_named_pipe(
pipe_name: impl AsRef<std::ffi::OsStr>,
) -> Result<Self, tokio::io::Error> {
// TODO: revisit if busy wait logic is required
let client = loop {
match tokio::net::windows::named_pipe::ClientOptions::new().open(&pipe_name) {
Ok(client) => break client,
Err(e)
if e.raw_os_error()
== Some(windows_sys::Win32::Foundation::ERROR_PIPE_BUSY as i32) =>
{
()
}
Err(e) => return Err(e),
}
tokio::time::sleep(std::time::Duration::from_millis(50)).await;
};
let client = tokio::net::windows::named_pipe::ClientOptions::new().open(&pipe_name)?;
Ok(Self::NamedPipe(client))
}