Skip to content

Commit

Permalink
hide windows for now
Browse files Browse the repository at this point in the history
  • Loading branch information
scarmuega committed Dec 20, 2023
1 parent 68ea22e commit 8b8e25e
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 33 deletions.
56 changes: 28 additions & 28 deletions pallas-network/src/facades.rs
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ impl NodeClient {
}

#[cfg(unix)]
pub async fn connect2(
pub async fn connect(
path: impl AsRef<Path> + Send + 'static,
magic: u64,
) -> Result<Self, Error> {
Expand All @@ -254,33 +254,33 @@ impl NodeClient {
Ok(client)
}

#[cfg(windows)]
pub async fn connect(
pipe_name: impl AsRef<std::ffi::OsStr>,
magic: u64,
) -> Result<Self, Error> {
let bearer = tokio::task::spawn_blocking(move || Bearer::connect_named_pipe(pipe_name))
.await
.expect("can't join tokio thread")
.map_err(Error::ConnectFailure)?;

let mut client = Self::new(bearer);

let versions = handshake::n2c::VersionTable::v10_and_above(magic);

let handshake = client
.handshake()
.handshake(versions)
.await
.map_err(Error::HandshakeProtocol)?;

if let handshake::Confirmation::Rejected(reason) = handshake {
error!(?reason, "handshake refused");
return Err(Error::IncompatibleVersion);
}

Ok(client)
}
// #[cfg(windows)]
// pub async fn connect(
// pipe_name: impl AsRef<std::ffi::OsStr>,
// magic: u64,
// ) -> Result<Self, Error> {
// let bearer = tokio::task::spawn_blocking(move ||
// Bearer::connect_named_pipe(pipe_name)) .await
// .expect("can't join tokio thread")
// .map_err(Error::ConnectFailure)?;

// let mut client = Self::new(bearer);

// let versions = handshake::n2c::VersionTable::v10_and_above(magic);

// let handshake = client
// .handshake()
// .handshake(versions)
// .await
// .map_err(Error::HandshakeProtocol)?;

// if let handshake::Confirmation::Rejected(reason) = handshake {
// error!(?reason, "handshake refused");
// return Err(Error::IncompatibleVersion);
// }

// Ok(client)
// }

#[cfg(unix)]
pub async fn handshake_query(
Expand Down
11 changes: 6 additions & 5 deletions pallas-network/src/multiplexer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,12 @@ impl Bearer {
Ok((Self::Unix(stream), addr))
}

#[cfg(windows)]
pub fn connect_named_pipe(pipe_name: impl AsRef<std::ffi::OsStr>) -> IOResult<Self> {
let client = tokio::net::windows::named_pipe::ClientOptions::new().open(&pipe_name)?;
Ok(Self::NamedPipe(client))
}
// #[cfg(windows)]
// pub fn connect_named_pipe(pipe_name: impl AsRef<std::ffi::OsStr>) ->
// IOResult<Self> { let client =
// tokio::net::windows::named_pipe::ClientOptions::new().open(&pipe_name)?;
// Ok(Self::NamedPipe(client))
// }

pub fn into_split(self) -> (BearerReadHalf, BearerWriteHalf) {
match self {

Check failure on line 126 in pallas-network/src/multiplexer.rs

View workflow job for this annotation

GitHub Actions / Check (windows-latest, stable)

non-exhaustive patterns: `Bearer::NamedPipe(_)` not covered
Expand Down

0 comments on commit 8b8e25e

Please sign in to comment.