From b229725ba00a604c8d15ca7e5bec44d7393a66b6 Mon Sep 17 00:00:00 2001 From: Conor Schaefer Date: Fri, 13 Oct 2023 15:01:56 -0700 Subject: [PATCH] fix: support windows builds Follow up to the addition of unix socket support. --- src/v034/server.rs | 5 ++++- src/v037/server.rs | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/v034/server.rs b/src/v034/server.rs index 539df2c..3b9a741 100644 --- a/src/v034/server.rs +++ b/src/v034/server.rs @@ -6,9 +6,10 @@ use futures::sink::SinkExt; use futures::stream::{FuturesOrdered, StreamExt}; use tokio::io::{AsyncReadExt, AsyncWriteExt}; use tokio::{ - net::{TcpListener, ToSocketAddrs, UnixListener}, + net::{TcpListener, ToSocketAddrs}, select, }; + use tokio_util::codec::{FramedRead, FramedWrite}; use tower::{Service, ServiceExt}; @@ -126,7 +127,9 @@ where ServerBuilder::default() } + #[cfg(not(target_os = "windows"))] pub async fn listen_unix(self, path: impl AsRef) -> Result<(), BoxError> { + use tokio::net::UnixListener; let listener = UnixListener::bind(path)?; let addr = listener.local_addr()?; tracing::info!(?addr, "ABCI server starting on uds"); diff --git a/src/v037/server.rs b/src/v037/server.rs index 5388e8c..2c5cb4e 100644 --- a/src/v037/server.rs +++ b/src/v037/server.rs @@ -6,9 +6,10 @@ use futures::sink::SinkExt; use futures::stream::{FuturesOrdered, StreamExt}; use tokio::io::{AsyncReadExt, AsyncWriteExt}; use tokio::{ - net::{TcpListener, ToSocketAddrs, UnixListener}, + net::{TcpListener, ToSocketAddrs}, select, }; + use tokio_util::codec::{FramedRead, FramedWrite}; use tower::{Service, ServiceExt}; @@ -126,7 +127,9 @@ where ServerBuilder::default() } + #[cfg(not(target_os = "windows"))] pub async fn listen_unix(self, path: impl AsRef) -> Result<(), BoxError> { + use tokio::net::UnixListener; let listener = UnixListener::bind(path)?; let addr = listener.local_addr()?; tracing::info!(?addr, "ABCI server starting on uds");