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

Commit 5430bbeb authored by Hsin-chen Chuang's avatar Hsin-chen Chuang
Browse files

floss: Abort freshness_check JoinHandle before dropping.

Dropping the handle doesn't abort the future job. This CL aborts the
future job properly to prevent from creating duplicate recurring tasks.

Bug: 244510343
Tag: #floss
Test: build.py --target test
Change-Id: I9d13ed4b54011de2532365ddfec802a719c8389f
parent a314c984
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -476,8 +476,11 @@ impl Bluetooth {
    /// Check whether found devices are still fresh. If they're outside the
    /// freshness window, send a notification to clear the device from clients.
    pub(crate) fn trigger_freshness_check(&mut self) {
        // Drop previous joinhandle
        if let Some(ref handle) = self.freshness_check {
            // Abort and drop the previous JoinHandle.
            handle.abort();
            self.freshness_check = None;
        }

        // A found device is considered fresh if:
        // * It was last seen less than |FOUND_DEVICE_FRESHNESS| ago.