Skip to content

Commit

Permalink
fix: support windows builds
Browse files Browse the repository at this point in the history
Follow up to the addition of unix socket support.
  • Loading branch information
conorsch committed Oct 13, 2023
1 parent 1e622b1 commit b229725
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/v034/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};

Expand Down Expand Up @@ -126,7 +127,9 @@ where
ServerBuilder::default()
}

#[cfg(not(target_os = "windows"))]
pub async fn listen_unix(self, path: impl AsRef<Path>) -> Result<(), BoxError> {
use tokio::net::UnixListener;
let listener = UnixListener::bind(path)?;
let addr = listener.local_addr()?;
tracing::info!(?addr, "ABCI server starting on uds");
Expand Down
5 changes: 4 additions & 1 deletion src/v037/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};

Expand Down Expand Up @@ -126,7 +127,9 @@ where
ServerBuilder::default()
}

#[cfg(not(target_os = "windows"))]
pub async fn listen_unix(self, path: impl AsRef<Path>) -> Result<(), BoxError> {
use tokio::net::UnixListener;
let listener = UnixListener::bind(path)?;
let addr = listener.local_addr()?;
tracing::info!(?addr, "ABCI server starting on uds");
Expand Down

0 comments on commit b229725

Please sign in to comment.