From 654a7f556118a32d47e9ebe9ba3ba577d8d7572d Mon Sep 17 00:00:00 2001 From: Ron Waldon-Howe Date: Sat, 14 Dec 2024 17:11:07 +1100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Expose=20the=20socket=20address?= =?UTF-8?q?=20clients=20can=20use?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Until now, `--print-address` would print the address specification, that is, the input used to determine how and where the server would listen. This would be useful for clients for `unix:path=...`, but for `unix:dir=...` and `unix:tmpdir=...` this would not work. So now we share the socket address that is produced from the address specification. --- src/bus/mod.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/bus/mod.rs b/src/bus/mod.rs index 82c429b..4810fe8 100644 --- a/src/bus/mod.rs +++ b/src/bus/mod.rs @@ -58,9 +58,16 @@ impl Bus { let (listener, auth_mechanism) = match address.transport() { #[cfg(unix)] Transport::Unix(unix) => { + // resolve address specification into address that clients can use let addr = Self::unix_addr(unix)?; - - (Self::unix_stream(addr).await?, AuthMechanism::External) + address = Address::try_from( + format!("unix:path={}", addr.as_pathname().unwrap().display()).as_str(), + )?; + + ( + Self::unix_stream(addr.clone()).await?, + AuthMechanism::External, + ) } Transport::Tcp(tcp) => { #[cfg(not(windows))]