From 59909f2ddc2f4d2079f023824ccc927471a9d555 Mon Sep 17 00:00:00 2001 From: Santiago Carmuega Date: Sat, 23 Dec 2023 15:31:24 -0300 Subject: [PATCH] fix(network): relax connect args lifetime (#367) --- pallas-network/src/facades.rs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/pallas-network/src/facades.rs b/pallas-network/src/facades.rs index cc834d94..d5f87f2b 100644 --- a/pallas-network/src/facades.rs +++ b/pallas-network/src/facades.rs @@ -3,7 +3,7 @@ use std::path::Path; use thiserror::Error; use tracing::error; -use tokio::net::TcpListener; +use tokio::net::{TcpListener, ToSocketAddrs}; #[cfg(unix)] use tokio::net::{unix::SocketAddr as UnixSocketAddr, UnixListener}; @@ -66,7 +66,7 @@ impl PeerClient { } } - pub async fn connect(addr: &'static str, magic: u64) -> Result { + pub async fn connect(addr: impl ToSocketAddrs, magic: u64) -> Result { let bearer = Bearer::connect_tcp(addr) .await .map_err(Error::ConnectFailure)?; @@ -232,10 +232,7 @@ impl NodeClient { } #[cfg(unix)] - pub async fn connect( - path: impl AsRef + Send + 'static, - magic: u64, - ) -> Result { + pub async fn connect(path: impl AsRef, magic: u64) -> Result { let bearer = Bearer::connect_unix(path) .await .map_err(Error::ConnectFailure)?;