diff --git a/packages/desktop/src/providers/network/provider.rs b/packages/desktop/src/providers/network/provider.rs index 67639325..c4fd6110 100644 --- a/packages/desktop/src/providers/network/provider.rs +++ b/packages/desktop/src/providers/network/provider.rs @@ -20,12 +20,7 @@ use super::{ pub struct NetworkProvider { pub config: Arc, abort_handle: Option, - netdev_data: Arc>, -} - -pub struct NetdevData { - pub default_interface: Arc>, - pub interfaces: Arc>>, + state: Arc>, } impl NetworkProvider { @@ -33,12 +28,7 @@ impl NetworkProvider { NetworkProvider { config: Arc::new(config), abort_handle: None, - netdev_data: Arc::new(Mutex::new(NetdevData { - default_interface: Arc::new(Mutex::new( - get_default_interface().unwrap(), - )), - interfaces: Arc::new(Mutex::new(get_interfaces())), - })), + state: Arc::new(Mutex::new(())), } } } @@ -46,14 +36,14 @@ impl NetworkProvider { #[async_trait] impl IntervalProvider for NetworkProvider { type Config = NetworkProviderConfig; - type State = Mutex; + type State = (); fn config(&self) -> Arc { self.config.clone() } - fn state(&self) -> Arc> { - self.netdev_data.clone() + fn state(&self) -> Arc<()> { + Arc::new(()) } fn abort_handle(&self) -> &Option { @@ -66,13 +56,12 @@ impl IntervalProvider for NetworkProvider { async fn get_refreshed_variables( _: &NetworkProviderConfig, - netdev_data: &Mutex, + state: &(), ) -> Result { - let netdev = netdev_data.lock().await; - let default_interface = netdev.default_interface.lock().await.clone(); + let default_interface = get_default_interface().unwrap(); - let interfaces = netdev.interfaces.lock().await; + let interfaces = get_interfaces(); let default_gateway_ssid_and_strength = get_primary_interface_ssid_and_strength()?; // Returns ssid = None, signal = None, connected = false if not on Windows for now