fix(network): skip unix listener on windows (#287)

This commit is contained in:
Santiago Carmuega 2023-09-11 03:31:05 +02:00 committed by GitHub
parent 219ae51b5a
commit 277f0d488a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 3 deletions

View file

@ -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<Self, Error> {
let (bearer, _) = Bearer::accept_unix(listener)

View file

@ -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;