fix(network): skip unix listener on windows (#287)
This commit is contained in:
parent
219ae51b5a
commit
277f0d488a
2 changed files with 7 additions and 3 deletions
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue