Update rmp-ipc and add timeout

Signed-off-by: trivernis <trivernis@protonmail.com>
pull/4/head
trivernis 3 years ago
parent 3dbd15e102
commit a2a6b858f0

@ -10,7 +10,7 @@ license = "gpl-3"
tracing = "0.1.29" tracing = "0.1.29"
thiserror = "1.0.30" thiserror = "1.0.30"
async-trait = {version = "0.1.51", optional=true} async-trait = {version = "0.1.51", optional=true}
rmp-ipc = {version = "0.9.2", optional=true} rmp-ipc = {version = "0.10.0", optional=true}
parking_lot = {version="0.11.2", optional=true} parking_lot = {version="0.11.2", optional=true}
serde_json = {version="1.0.68", optional=true} serde_json = {version="1.0.68", optional=true}
directories = {version="4.0.1", optional=true} directories = {version="4.0.1", optional=true}

@ -14,6 +14,7 @@ use rmp_ipc::ipc::stream_emitter::EmitMetadata;
use rmp_ipc::payload::{EventReceivePayload, EventSendPayload}; use rmp_ipc::payload::{EventReceivePayload, EventSendPayload};
use rmp_ipc::prelude::{AsyncProtocolStream, AsyncStreamProtocolListener}; use rmp_ipc::prelude::{AsyncProtocolStream, AsyncStreamProtocolListener};
use rmp_ipc::IPCBuilder; use rmp_ipc::IPCBuilder;
use std::time::Duration;
#[async_trait] #[async_trait]
pub trait IPCApi<S: AsyncProtocolStream> { pub trait IPCApi<S: AsyncProtocolStream> {
@ -82,6 +83,7 @@ where
pub async fn connect(address: L::AddressType) -> ApiResult<Self> { pub async fn connect(address: L::AddressType) -> ApiResult<Self> {
let ctx = IPCBuilder::<L>::new() let ctx = IPCBuilder::<L>::new()
.address(address) .address(address)
.timeout(Duration::from_secs(10))
.build_pooled_client(8) .build_pooled_client(8)
.await?; .await?;
let client = Self::new(ctx); let client = Self::new(ctx);

Loading…
Cancel
Save