MessageStream instance does not keep the connection open
Howdie, thanks so much for sharing this project!
My use case is that I'd like to build something similar to dbus-monitor
, but making it easier to trigger executables/etc based on specific xdg-desktop-portal messages on DBus: https://gitlab.com/jokeyrhyme/xdp-spy-rs
Note that basic monitoring behaviour is already working, but I'm using the dbus crate which wraps the C implementation, and accessing DBus message bodies safely is not as convenient as I'd like
So, I'm now trying to switch to the zbus crate, especially because it uses serde-style deserializers for message bodies, which I'm very excited about
I've pretty much copy-pasted the example from here: https://docs.rs/zbus/2.0.0/zbus/struct.Connection.html#monitoring-all-messages, with my Cargo.toml containing:
[dependencies]
futures = "0.3"
tokio = { version = "1", features = ["macros", "rt-multi-thread", "time"] }
zbus = { version = "2", features = ["tokio"] }
zvariant = "3"
But, when I run this, it outputs a single NameLost signal and exits with code 0 (success):
Msg { type: Signal, sender: UniqueName(Str(Borrowed("org.freedesktop.DBus"))), path: ObjectPath("/org/freedesktop/DBus"), iface: InterfaceName(Str(Borrowed("org.freedesktop.DBus"))), member: MemberName(Str(Borrowed("NameLost"))), body: Signature: [
s (115),
] }
If I switch to using a ConnectionBuilder
instead, and set the name, then I get this above line twice and then it exits with code 0, e.g.
let connection = ConnectionBuilder::session()?
.name("com.gitlab.jokeyrhyme.xdg-spy")?
.build()
.await?;
My expectation is that dbus-monitor
, and my master (with dbus crate), and my rewrite (with zbus crate) should all behave the same:
- connect to session bus
- output messages caused when messing with xdg-desktop-portal features ( e.g. screenshare at https://meet.jit.si/ )
- remain open and monitoring, without terminating
But, as the zbus monitoring example is not matching this behaviour, I'm assuming I've done something wrong or that there's perhaps something else I need to do to get it to match the behaviour?
Any suggestions on what I can try differently? Or why my session bus seems to work with the dbus crate and dbus-monitor
but seems to behaviour differently with the zbus monitoring example?
Thanks so much!