From b86b1fd065d8a48d5ebb4cb3821a7dca8ae63988 Mon Sep 17 00:00:00 2001 From: Wiktor Kwapisiewicz Date: Sat, 23 Mar 2024 10:56:48 +0100 Subject: [PATCH] Fix compilation on Windows Signed-off-by: Wiktor Kwapisiewicz --- src/agent.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/agent.rs b/src/agent.rs index 86d18ee..cb79ec9 100644 --- a/src/agent.rs +++ b/src/agent.rs @@ -4,7 +4,9 @@ use bytes::{Buf, BufMut, BytesMut}; use futures::{SinkExt, TryStreamExt}; use log::{error, info}; use tokio::io::{AsyncRead, AsyncWrite}; -use tokio::net::{TcpListener, TcpStream, UnixListener, UnixStream}; +use tokio::net::{TcpListener, TcpStream}; +#[cfg(unix)] +use tokio::net::{UnixListener, UnixStream}; use tokio_util::codec::{Decoder, Encoder, Framed}; use std::fmt; @@ -59,6 +61,7 @@ pub trait ListeningSocket { async fn accept(&self) -> io::Result; } +#[cfg(unix)] #[async_trait] impl ListeningSocket for UnixListener { type Stream = UnixStream; @@ -134,6 +137,7 @@ pub trait Agent: 'static + Sync + Send + Sized { } async fn bind(mut self, listener: service_binding::Listener) -> Result<(), AgentError> { match listener { + #[cfg(unix)] service_binding::Listener::Unix(listener) => { self.listen(UnixListener::from_std(listener)?).await }