-
-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🐛 Expose the socket address clients can use #182
base: main
Are you sure you want to change the base?
🐛 Expose the socket address clients can use #182
Conversation
654a7f5
to
aa8fa3b
Compare
f8fd47f
to
0e6497a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Look great otherwise.
21415a9
to
50d093f
Compare
50d093f
to
77fa221
Compare
src/bus/mod.rs
Outdated
#[cfg(unix)] | ||
use std::{env, path::Path}; | ||
use std::{str::FromStr, sync::Arc}; | ||
|
||
use anyhow::{bail, Ok, Result}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also this change is unrelated to the commit. :) I wouldn't have even mentioned it but since you're going to update the commit anyway. :)
77fa221
to
4bee358
Compare
src/bus/mod.rs
Outdated
@@ -2,6 +2,7 @@ use anyhow::{bail, Ok, Result}; | |||
#[cfg(unix)] | |||
use std::{env, path::Path}; | |||
use std::{str::FromStr, sync::Arc}; | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
still. 😢
4bee358
to
54d1535
Compare
Previously, we'd take the `--address` or default address, resolve it into the socket address, and start listening on that address. But we need to be able to expose that address to clients, too. So we break `Bus::unix_stream()` apart giving us a separate `Bus::unix_addr()` and access to the intermediate socket address.
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 we produce from the address specification.
address = Address::try_from( | ||
format!("unix:path={}", addr.as_pathname().unwrap().display()).as_str(), | ||
)?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So sorry but I did point out this before here: You don't (at least should not) need any parsing here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR
takes theaddresses the issue identified here: #175 (comment)BusType
,--session
, and--system
work from #159 . And then builds upon that (perhaps unnecessarily) to fixi.e.
--print-address
previously didn't always produce a bus address that clients could use.I've confirmed that the output from
--print-address
can be used withDBUS_SESSION_BUS_ADDRESS=... cargo test
in the zbus repository