Skip to content

Commit

Permalink
Don't add discovered devices twice
Browse files Browse the repository at this point in the history
If discovery is already enabled do not try to discover devices again.
  • Loading branch information
swsnr committed Jan 1, 2025
1 parent 5df8ab1 commit 3b2399c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/app/model/device_discovery.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ mod imp {

impl DeviceDiscovery {
fn set_discovery_enabled(&self, enabled: bool) {
if self.discovery_enabled.get() == enabled {
// Do nothing if the discovery state is already up to date.
return;
}
self.discovery_enabled.replace(enabled);
self.obj().notify_discovery_enabled();
if enabled {
Expand Down

0 comments on commit 3b2399c

Please sign in to comment.