diff --git a/src/v034/server.rs b/src/v034/server.rs index 539df2c..8119624 100644 --- a/src/v034/server.rs +++ b/src/v034/server.rs @@ -1,24 +1,27 @@ use std::convert::{TryFrom, TryInto}; -use std::path::Path; use futures::future::{FutureExt, TryFutureExt}; 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}; use crate::BoxError; use tendermint::abci::MethodKind; - use tendermint::v0_34::abci::{ ConsensusRequest, ConsensusResponse, InfoRequest, InfoResponse, MempoolRequest, MempoolResponse, Request, Response, SnapshotRequest, SnapshotResponse, }; +use tokio_util::codec::{FramedRead, FramedWrite}; +use tower::{Service, ServiceExt}; + +#[cfg(target_family = "unix")] +use std::path::Path; +#[cfg(target_family = "unix")] +use tokio::net::UnixListener; /// An ABCI server which listens for connections and forwards requests to four /// component ABCI [`Service`]s. @@ -126,6 +129,7 @@ where ServerBuilder::default() } + #[cfg(target_family = "unix")] pub async fn listen_unix(self, path: impl AsRef) -> Result<(), BoxError> { let listener = UnixListener::bind(path)?; let addr = listener.local_addr()?; diff --git a/src/v037/server.rs b/src/v037/server.rs index 5388e8c..3e46c06 100644 --- a/src/v037/server.rs +++ b/src/v037/server.rs @@ -1,20 +1,25 @@ use std::convert::{TryFrom, TryInto}; -use std::path::Path; use futures::future::{FutureExt, TryFutureExt}; 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}; use crate::BoxError; use tendermint::abci::MethodKind; +#[cfg(target_family = "unix")] +use std::path::Path; +#[cfg(target_family = "unix")] +use tokio::net::UnixListener; + use tendermint::v0_37::abci::{ ConsensusRequest, ConsensusResponse, InfoRequest, InfoResponse, MempoolRequest, MempoolResponse, Request, Response, SnapshotRequest, SnapshotResponse, @@ -126,6 +131,7 @@ where ServerBuilder::default() } + #[cfg(target_family = "unix")] pub async fn listen_unix(self, path: impl AsRef) -> Result<(), BoxError> { let listener = UnixListener::bind(path)?; let addr = listener.local_addr()?;