|
1 | 1 | use std::convert::{TryFrom, TryInto};
|
2 |
| -use std::path::Path; |
3 | 2 |
|
4 | 3 | use futures::future::{FutureExt, TryFutureExt};
|
5 | 4 | use futures::sink::SinkExt;
|
6 | 5 | use futures::stream::{FuturesOrdered, StreamExt};
|
7 | 6 | use tokio::io::{AsyncReadExt, AsyncWriteExt};
|
8 | 7 | use tokio::{
|
9 |
| - net::{TcpListener, ToSocketAddrs, UnixListener}, |
| 8 | + net::{TcpListener, ToSocketAddrs}, |
10 | 9 | select,
|
11 | 10 | };
|
12 |
| -use tokio_util::codec::{FramedRead, FramedWrite}; |
13 |
| -use tower::{Service, ServiceExt}; |
14 | 11 |
|
15 | 12 | use crate::BoxError;
|
16 | 13 | use tendermint::abci::MethodKind;
|
17 |
| - |
18 | 14 | use tendermint::v0_34::abci::{
|
19 | 15 | ConsensusRequest, ConsensusResponse, InfoRequest, InfoResponse, MempoolRequest,
|
20 | 16 | MempoolResponse, Request, Response, SnapshotRequest, SnapshotResponse,
|
21 | 17 | };
|
| 18 | +use tokio_util::codec::{FramedRead, FramedWrite}; |
| 19 | +use tower::{Service, ServiceExt}; |
| 20 | + |
| 21 | +#[cfg(target_family = "unix")] |
| 22 | +use std::path::Path; |
| 23 | +#[cfg(target_family = "unix")] |
| 24 | +use tokio::net::UnixListener; |
22 | 25 |
|
23 | 26 | /// An ABCI server which listens for connections and forwards requests to four
|
24 | 27 | /// component ABCI [`Service`]s.
|
@@ -126,6 +129,7 @@ where
|
126 | 129 | ServerBuilder::default()
|
127 | 130 | }
|
128 | 131 |
|
| 132 | + #[cfg(target_family = "unix")] |
129 | 133 | pub async fn listen_unix(self, path: impl AsRef<Path>) -> Result<(), BoxError> {
|
130 | 134 | let listener = UnixListener::bind(path)?;
|
131 | 135 | let addr = listener.local_addr()?;
|
|
0 commit comments