Skip to content

Commit 079976c

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 7a05710 commit 079976c

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

zbus/src/proxy/mod.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,12 @@ impl PropertiesCache {
358358
Some(Either::Left(_update)) => {
359359
// discard updates prior to the initial population
360360
}
361+
Some(Either::Right(Err(Error::FDO(fdo))))
362+
if matches!(*fdo, fdo::Error::ServiceUnknown(_)) =>
363+
{
364+
// DBus service doesn't exist. But may appear later on the bus.
365+
break;
366+
}
361367
Some(Either::Right(populate)) => {
362368
populate?.body().deserialize().map(|values| {
363369
self.update_cache(&uncached_properties, &values, &[], &interface);

0 commit comments

Comments
 (0)