diff --git a/veilid-server/src/client_api.rs b/veilid-server/src/client_api.rs index 5bc3cf56..6ddc1ec4 100644 --- a/veilid-server/src/client_api.rs +++ b/veilid-server/src/client_api.rs @@ -456,7 +456,7 @@ impl ClientApi { .await; debug!( - "Closed Client API Connection: {:?} -> {:?}", + "Closed TCP Client API Connection: {:?} -> {:?}", peer_addr, local_addr ); @@ -486,7 +486,7 @@ impl ClientApi { self.run_json_request_processor(reader, writer, stop_token) .await; - debug!("Closed Client API Connection",); + debug!("Closed IPC Client API Connection",); awg.done(); } diff --git a/veilid-tools/src/ipc/ipc_tokio/unix.rs b/veilid-tools/src/ipc/ipc_tokio/unix.rs index 461220b5..8abc434b 100644 --- a/veilid-tools/src/ipc/ipc_tokio/unix.rs +++ b/veilid-tools/src/ipc/ipc_tokio/unix.rs @@ -100,7 +100,7 @@ impl Drop for IpcIncoming { pub struct IpcListener { path: Option, - internal: Option, + internal: Option>, } impl IpcListener { @@ -108,14 +108,20 @@ impl IpcListener { pub async fn bind>(path: P) -> io::Result { Ok(Self { path: Some(path.as_ref().to_path_buf()), - internal: Some(UnixListener::bind(path)?), + internal: Some(Arc::new(UnixListener::bind(path)?)), }) } /// Accepts a new incoming connection to this listener. - pub async fn accept(&self) -> io::Result { - Ok(IpcStream { - internal: self.internal.as_ref().unwrap().accept().await?.0, + pub fn accept(&self) -> SendPinBoxFuture> { + let this = IpcListener { + path: self.path.clone(), + internal: self.internal.clone(), + }; + Box::pin(async move { + Ok(IpcStream { + internal: this.internal.as_ref().unwrap().accept().await?.0, + }) }) } @@ -123,7 +129,9 @@ impl IpcListener { pub fn incoming(mut self) -> IpcIncoming { IpcIncoming { path: self.path.take().unwrap(), - internal: UnixListenerStream::new(self.internal.take().unwrap()), + internal: UnixListenerStream::new( + Arc::into_inner(self.internal.take().unwrap()).unwrap(), + ), } } }