Skip to content

Commit

Permalink
✨ Implement unix:dir and unix:tmpdir for --address
Browse files Browse the repository at this point in the history
According to https://dbus.freedesktop.org/doc/dbus-specification.html ,
for unix:tmpdir, the service _may_ create an abstract socket,
but is not required to do so, thus our implementation is the same as our
unix:dir, as suggested by the specification
  • Loading branch information
jokeyrhyme committed Dec 4, 2024
1 parent 295d7dd commit 8d67580
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/bus/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,16 @@ impl Bus {

addr
}
UnixSocket::Dir(_) => bail!("`dir` transport is not supported (yet)."),
UnixSocket::TmpDir(_) => bail!("`tmpdir` transport is not supported (yet)."),
UnixSocket::Dir(dir) | UnixSocket::TmpDir(dir) => {
let path = dir.join(format!("dbus-{}", fastrand::u32(1_000_000..u32::MAX)));
let addr = SocketAddr::from_pathname(&path)?;
info!(
"Listening on UNIX socket file `{}`.",
path.to_string_lossy()
);

addr
}
_ => bail!("Unsupported address."),
};
let std_listener =
Expand Down

0 comments on commit 8d67580

Please sign in to comment.