Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 18f88ec0 authored by Jesse Melhuish's avatar Jesse Melhuish Committed by Automerger Merge Worker
Browse files

Merge "Floss: Add more descriptive error messages when await calls cause...

Merge "Floss: Add more descriptive error messages when await calls cause panics" into main am: 81d9a9d8

Original change: https://android-review.googlesource.com/c/platform/packages/modules/Bluetooth/+/3146661



Change-Id: Idcef2c8cb1ce96824658154e6509b5815454e4d2
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 68623db4 81d9a9d8
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -103,7 +103,9 @@ impl DisconnectWatcher {
    pub async fn setup_watch(&mut self, conn: Arc<SyncConnection>) {
        let mr = MatchRule::new_signal("org.freedesktop.DBus", "NameOwnerChanged");

        conn.add_match_no_cb(&mr.match_str()).await.unwrap();
        conn.add_match_no_cb(&mr.match_str())
            .await
            .expect("Unable to add match to D-Bus for monitoring client disconnects");
        let callbacks_map = self.callbacks.clone();
        conn.start_receive(
            mr,
+7 −2
Original line number Diff line number Diff line
@@ -296,7 +296,9 @@ impl PowerdSuspendManager {
        let mr = MatchRule::new_signal(POWERD_INTERFACE, SUSPEND_IMMINENT_SIGNAL)
            .with_sender(POWERD_SERVICE)
            .with_path(POWERD_PATH);
        self.conn.add_match_no_cb(&mr.match_str()).await.unwrap();
        self.conn.add_match_no_cb(&mr.match_str()).await.expect(
            "Unable to add match to D-Bus for monitoring SuspendImminent signal from powerd",
        );

        let tx = self.tx.clone();
        self.conn.start_receive(
@@ -330,7 +332,10 @@ impl PowerdSuspendManager {
        let mr = MatchRule::new_signal(POWERD_INTERFACE, SUSPEND_DONE_SIGNAL)
            .with_sender(POWERD_SERVICE)
            .with_path(POWERD_PATH);
        self.conn.add_match_no_cb(&mr.match_str()).await.unwrap();
        self.conn
            .add_match_no_cb(&mr.match_str())
            .await
            .expect("Unable to add match to D-Bus for monitoring SuspendDone signal from powerd");
        let tx = self.tx.clone();
        self.conn.start_receive(
            mr,
+8 −2
Original line number Diff line number Diff line
@@ -104,7 +104,10 @@ impl ServiceWatcher {
        on_unavailable: Box<dyn Fn() + Send>,
    ) {
        let mr = MatchRule::new_signal(DBUS_INTERFACE, DBUS_NAME_OWNER_CHANGED);
        self.conn.add_match_no_cb(&mr.match_str()).await.unwrap();
        self.conn
            .add_match_no_cb(&mr.match_str())
            .await
            .expect("Unable to add match to D-Bus for monitoring service owner change");
        let service_name = self.service_name.clone();
        let context = self.context.clone();
        self.conn.start_receive(
@@ -195,7 +198,10 @@ impl ServiceWatcher {

        // Monitor interface appearing.
        let mr = MatchRule::new_signal(DBUS_OBJMGR_INTERFACE, DBUS_INTERFACES_ADDED);
        self.conn.add_match_no_cb(&mr.match_str()).await.unwrap();
        self.conn
            .add_match_no_cb(&mr.match_str())
            .await
            .expect("Unable to add match to D-Bus for monitoring interface changes");
        let context = self.context.clone();
        self.conn.start_receive(
            mr,
+2 −1
Original line number Diff line number Diff line
@@ -323,7 +323,8 @@ fn configure_pid(pid_tx: mpsc::Sender<Message>) {

        loop {
            let r = pid_async_fd.readable_mut();
            let mut fd_ready = r.await.unwrap();
            let mut fd_ready =
                r.await.expect(format!("pid file in {} never became readable", PID_DIR).as_str());
            let mut buffer: [u8; 1024] = [0; 1024];
            debug!("Found new pid inotify entries. Reading them");
            match fd_ready.try_io(|inner| inner.get_mut().read_events(&mut buffer)) {
+2 −1
Original line number Diff line number Diff line
@@ -27,7 +27,8 @@ impl Alarm {

    /// Completes when the alarm has expired
    pub async fn expired(&self) {
        let mut read_ready = self.fd.readable().await.unwrap();
        let mut read_ready =
            self.fd.readable().await.expect("TimerFd is never expected to fail to be readable");
        read_ready.clear_ready();
        drop(read_ready);
        // Will not block, since we have confirmed it is readable