Skip to content

Commit b6d49c3

Browse files
committed
🐛 zb: Make PropertyStream yield changes if service starts later
This seems like the simplest way to address #1111. Before this, a `PropertyStream` created when a service wasn't running would never yield a value, even if the service started later and send property change signals. But if a service stopped, and then was restarted, property changes would be received. It seems `PropertiesCache::init()` was returning an error, from trying to call `GetAll` with a destination that doesn't exist. Instead, let `init()` complete successfully (without populating the cache), so it returns a `PropertiesChangedStream` which is then monitored for changes. It may also be good if it yielded values when a service takes ownership of the name, but that's a separate issue since it also applies to service restarts. And an application can handle `OwnerChanged` itself relatively easily.
1 parent 89f54ed commit b6d49c3

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

zbus/src/proxy/mod.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,14 @@ impl PropertiesCache {
355355
Some(Either::Left(_update)) => {
356356
// discard updates prior to the initial population
357357
}
358+
// FIXME: Use deref pattern when stable
359+
// https://github.com/rust-lang/rust/issues/87121
360+
Some(Either::Right(Err(Error::FDO(fdo))))
361+
if matches!(*fdo, fdo::Error::ServiceUnknown(_)) =>
362+
{
363+
// DBus service doesn't exist. But may appear later on the bus.
364+
break;
365+
}
358366
Some(Either::Right(populate)) => {
359367
populate?.body().deserialize().map(|values| {
360368
self.update_cache(&uncached_properties, &values, &[], &interface);

0 commit comments

Comments
 (0)