From 277f0d488a9438ddaf11e18d48a50ebd061861c2 Mon Sep 17 00:00:00 2001 From: Santiago Carmuega Date: Mon, 11 Sep 2023 03:31:05 +0200 Subject: [PATCH] fix(network): skip unix listener on windows (#287) --- pallas-network/src/facades.rs | 6 +++++- pallas-network/src/multiplexer.rs | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/pallas-network/src/facades.rs b/pallas-network/src/facades.rs index 3d77cae..0e99c5d 100644 --- a/pallas-network/src/facades.rs +++ b/pallas-network/src/facades.rs @@ -1,10 +1,13 @@ use std::path::Path; use thiserror::Error; -use tokio::net::{TcpListener, UnixListener}; +use tokio::net::TcpListener; use tokio::task::JoinHandle; use tracing::{debug, error}; +#[cfg(not(target_os = "windows"))] +use tokio::net::UnixListener; + use crate::miniprotocols::handshake::{n2c, n2n, Confirmation, VersionNumber}; use crate::miniprotocols::PROTOCOL_N2N_HANDSHAKE; use crate::{ @@ -250,6 +253,7 @@ pub struct NodeServer { // statequery: localstate::Server, } +#[cfg(not(target_os = "windows"))] impl NodeServer { pub async fn accept(listener: &UnixListener, magic: u64) -> Result { let (bearer, _) = Bearer::accept_unix(listener) diff --git a/pallas-network/src/multiplexer.rs b/pallas-network/src/multiplexer.rs index d1e4ce7..ffd5b05 100644 --- a/pallas-network/src/multiplexer.rs +++ b/pallas-network/src/multiplexer.rs @@ -6,14 +6,14 @@ use std::net::SocketAddr; use std::path::Path; use thiserror::Error; use tokio::io::AsyncWriteExt; -use tokio::net::{TcpListener, TcpStream, ToSocketAddrs, UnixListener}; +use tokio::net::{TcpListener, TcpStream, ToSocketAddrs}; use tokio::select; use tokio::sync::mpsc::error::SendError; use tokio::time::Instant; use tracing::{debug, error, trace}; #[cfg(not(target_os = "windows"))] -use tokio::net::UnixStream; +use tokio::net::{UnixListener, UnixStream}; const HEADER_LEN: usize = 8;