Skip to content

Commit

Permalink
Fix non-unix (windows) build referencing unix sockets (hydro-project#411
Browse files Browse the repository at this point in the history
)
  • Loading branch information
MingweiSamuel authored Feb 27, 2023
1 parent fff4d0a commit 5dac7e4
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
1 change: 1 addition & 0 deletions hydro_cli/src/core/localhost.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ impl Host for LocalhostHost {

#[cfg(not(unix))]
{
let _ = id;
false
}
}
Expand Down
15 changes: 12 additions & 3 deletions hydroflow/src/util/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,16 @@ use std::{net::SocketAddr, path::PathBuf, pin::Pin};

use futures::{Sink, Stream};
use serde::{Deserialize, Serialize};
use tokio::net::{TcpListener, TcpStream, UnixListener, UnixStream};
use tokio::net::{TcpListener, TcpStream};
#[cfg(unix)]
use tokio::net::{UnixListener, UnixStream};
#[cfg(not(unix))]
type UnixListener = !;
use tokio_util::codec::LinesCodecError;

use super::{tcp_lines, unix_lines};
use super::tcp_lines;
#[cfg(unix)]
use super::unix_lines;

#[derive(Serialize, Deserialize, Clone, Debug)]
pub enum BindType {
Expand Down Expand Up @@ -65,7 +71,8 @@ impl ConnectionPipe {

#[cfg(not(unix))]
{
panic!("Unix sockets are not supported on this platform")
let _ = path;
panic!("Unix sockets are not supported on this platform");
}
}
ConnectionPipe::TcpPort(addr) => {
Expand Down Expand Up @@ -100,6 +107,7 @@ impl BoundConnection {

#[cfg(not(unix))]
{
let _ = listener;
panic!("Unix sockets are not supported on this platform")
}
}
Expand Down Expand Up @@ -127,6 +135,7 @@ impl BoundConnection {

#[cfg(not(unix))]
{
let _ = listener;
panic!("Unix sockets are not supported on this platform")
}
}
Expand Down
3 changes: 3 additions & 0 deletions hydroflow/src/util/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ mod udp;
pub use udp::*;
mod tcp;
pub use tcp::*;

#[cfg(unix)]
mod socket;
#[cfg(unix)]
pub use socket::*;

#[cfg(feature = "cli_integration")]
Expand Down

0 comments on commit 5dac7e4

Please sign in to comment.