chore(deps): update NamedPipes related deps (#336)
This commit is contained in:
parent
975aedb135
commit
6203fe1ecd
2 changed files with 2 additions and 24 deletions
|
|
@ -8,10 +8,7 @@ homepage = "https://github.com/txpipe/pallas"
|
||||||
documentation = "https://docs.rs/pallas-upstream"
|
documentation = "https://docs.rs/pallas-upstream"
|
||||||
license = "Apache-2.0"
|
license = "Apache-2.0"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
authors = [
|
authors = ["Santiago Carmuega <santiago@carmuega.me>", "Pi Lanningham <pi.lanningham@gmail.com>"]
|
||||||
"Santiago Carmuega <santiago@carmuega.me>",
|
|
||||||
"Pi Lanningham <pi.lanningham@gmail.com>",
|
|
||||||
]
|
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
byteorder = "1.4.3"
|
byteorder = "1.4.3"
|
||||||
|
|
@ -23,10 +20,6 @@ thiserror = "1.0.31"
|
||||||
tokio = { version = "1", features = ["net", "io-util", "time", "sync", "macros"] }
|
tokio = { version = "1", features = ["net", "io-util", "time", "sync", "macros"] }
|
||||||
tracing = "0.1.37"
|
tracing = "0.1.37"
|
||||||
|
|
||||||
[target.'cfg(windows)'.dependencies]
|
|
||||||
tokio-named-pipes = "0.1.0"
|
|
||||||
windows-sys = "0.48.0"
|
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
tracing-subscriber = "0.3.16"
|
tracing-subscriber = "0.3.16"
|
||||||
tokio = { version = "1", features = ["full"] }
|
tokio = { version = "1", features = ["full"] }
|
||||||
|
|
|
||||||
|
|
@ -103,22 +103,7 @@ impl Bearer {
|
||||||
pub async fn connect_named_pipe(
|
pub async fn connect_named_pipe(
|
||||||
pipe_name: impl AsRef<std::ffi::OsStr>,
|
pipe_name: impl AsRef<std::ffi::OsStr>,
|
||||||
) -> Result<Self, tokio::io::Error> {
|
) -> Result<Self, tokio::io::Error> {
|
||||||
// TODO: revisit if busy wait logic is required
|
let client = tokio::net::windows::named_pipe::ClientOptions::new().open(&pipe_name)?;
|
||||||
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;
|
|
||||||
};
|
|
||||||
|
|
||||||
Ok(Self::NamedPipe(client))
|
Ok(Self::NamedPipe(client))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue