Fix config and IPC lifecycle issues and remove obsolete code
This commit is contained in:
1 parent
8007f7a107
commit
5d9673aad3
14 files changed
+723
-753
No files matched your search
@@ -216,7 +216,7 @@ async fn listen(
|
||||
let mut signals = proxy.receive_signal("PrepareForSleep").await?;
|
||||
// AddMatch succeeds even when logind is absent. Only call the listener
|
||||
// recovered once the service is present, and retry if its owner changes.
|
||||
connection
|
||||
let owner = connection
|
||||
.call_method(
|
||||
Some("org.freedesktop.DBus"),
|
||||
"/org/freedesktop/DBus",
|
||||
@@ -236,7 +236,7 @@ async fn listen(
|
||||
|
||||
future::race(
|
||||
async {
|
||||
owners.next().await;
|
||||
owner_changed_after(&mut owners, owner.recv_position()).await;
|
||||
Ok(MonitorExit::Reconnect)
|
||||
},
|
||||
async {
|
||||
@@ -253,5 +253,16 @@ async fn listen(
|
||||
.await
|
||||
}
|
||||
|
||||
// Owner changes queued during subscription setup are already reflected in the
|
||||
// GetNameOwner reply. Only a later change interrupts this recovered listener.
|
||||
async fn owner_changed_after(owners: &mut zbus::proxy::OwnerChangedStream<'_>, baseline: zbus::message::Sequence) {
|
||||
use zbus::export::ordered_stream::OrderedStreamExt;
|
||||
while let Some((sequence, _)) = owners.next_before(None).await.into_tuple() {
|
||||
if sequence > baseline {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests;
|
||||
Reference in new issue
Block a user