mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-29 02:20:39 +00:00
Compile UnixStream support only on unix systems
This commit is contained in:
parent
dbdff83132
commit
3d4070a139
4 changed files with 25 additions and 15 deletions
|
@ -15,6 +15,7 @@ pub struct Cli {
|
||||||
pub json_rpc_tcp: Option<Option<SocketAddr>>,
|
pub json_rpc_tcp: Option<Option<SocketAddr>>,
|
||||||
|
|
||||||
/// UNIX socket address and port of signal-cli daemon
|
/// UNIX socket address and port of signal-cli daemon
|
||||||
|
#[cfg(unix)]
|
||||||
#[arg(long, conflicts_with = "json_rpc_tcp")]
|
#[arg(long, conflicts_with = "json_rpc_tcp")]
|
||||||
pub json_rpc_socket: Option<Option<OsString>>,
|
pub json_rpc_socket: Option<Option<OsString>>,
|
||||||
|
|
||||||
|
|
|
@ -410,6 +410,7 @@ pub async fn connect_tcp(
|
||||||
Ok(ClientBuilder::default().build_with_tokio(sender, receiver))
|
Ok(ClientBuilder::default().build_with_tokio(sender, receiver))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(unix)]
|
||||||
pub async fn connect_unix(
|
pub async fn connect_unix(
|
||||||
socket_path: impl AsRef<Path>,
|
socket_path: impl AsRef<Path>,
|
||||||
) -> Result<impl SubscriptionClientT, std::io::Error> {
|
) -> Result<impl SubscriptionClientT, std::io::Error> {
|
||||||
|
|
|
@ -482,6 +482,12 @@ async fn connect(cli: Cli) -> Result<Value, RpcError> {
|
||||||
|
|
||||||
handle_command(cli, client).await
|
handle_command(cli, client).await
|
||||||
} else {
|
} else {
|
||||||
|
#[cfg(windows)]
|
||||||
|
{
|
||||||
|
Err(RpcError::Custom("Invalid socket".into()))
|
||||||
|
}
|
||||||
|
#[cfg(unix)]
|
||||||
|
{
|
||||||
let socket_path = cli
|
let socket_path = cli
|
||||||
.json_rpc_socket
|
.json_rpc_socket
|
||||||
.clone()
|
.clone()
|
||||||
|
@ -500,6 +506,7 @@ async fn connect(cli: Cli) -> Result<Value, RpcError> {
|
||||||
|
|
||||||
handle_command(cli, client).await
|
handle_command(cli, client).await
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn stream_next(
|
async fn stream_next(
|
||||||
|
|
|
@ -2,6 +2,7 @@ use futures_util::{stream::StreamExt, Sink, SinkExt, Stream};
|
||||||
use jsonrpsee::core::client::{ReceivedMessage, TransportReceiverT, TransportSenderT};
|
use jsonrpsee::core::client::{ReceivedMessage, TransportReceiverT, TransportSenderT};
|
||||||
use thiserror::Error;
|
use thiserror::Error;
|
||||||
|
|
||||||
|
#[cfg(unix)]
|
||||||
pub mod ipc;
|
pub mod ipc;
|
||||||
mod stream_codec;
|
mod stream_codec;
|
||||||
pub mod tcp;
|
pub mod tcp;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue