diff --git a/src/dbus_wrappers/active_connection.rs b/src/dbus_wrappers/active_connection.rs index 93fadf49b8229d382f97066887ded0a5a2ed3eac..24cda4e9d20f517057bc87667c6ef6238b55a99b 100644 --- a/src/dbus_wrappers/active_connection.rs +++ b/src/dbus_wrappers/active_connection.rs @@ -8,13 +8,9 @@ use dbus::{ use nm_reactor_dbus_codegen::network_manager_connection_active::{ OrgFreedesktopNetworkManagerConnectionActive, - OrgFreedesktopNetworkManagerConnectionActiveStateChanged, }; -use super::signal::SignalStreamWrapper; - pub struct ActiveConnectionWrapper<'a> { - conn: Arc<SyncConnection>, proxy: Box<dyn OrgFreedesktopNetworkManagerConnectionActive + Send + Sync + 'a>, path: Path<'a>, } @@ -30,11 +26,10 @@ impl<'a> ActiveConnectionWrapper<'a> { "org.freedesktop.NetworkManager", path.clone(), Duration::from_millis(5000), - conn.clone(), + conn, ); ActiveConnectionWrapper { - conn, proxy: Box::new(proxy), path, } @@ -55,11 +50,4 @@ impl<'a> ActiveConnectionWrapper<'a> { Ok(device_paths) } - - pub async fn state_changed_signal_stream( - &self, - ) -> anyhow::Result<SignalStreamWrapper<OrgFreedesktopNetworkManagerConnectionActiveStateChanged>> - { - SignalStreamWrapper::from_match_rule(&self.conn, None, Some(self.path.clone())).await - } } diff --git a/src/dbus_wrappers/connection.rs b/src/dbus_wrappers/connection.rs index 038e929bcc4373b1e9b120dc5d91ba0a25251695..481e7ba3da996e9b42daf10d14b31851c42e2b02 100644 --- a/src/dbus_wrappers/connection.rs +++ b/src/dbus_wrappers/connection.rs @@ -1,35 +1,19 @@ -use std::{sync::Arc, time::Duration}; - use dbus::{ - nonblock::{Proxy, SyncConnection}, Path, }; -use nm_reactor_dbus_codegen::network_manager_connection_active::OrgFreedesktopNetworkManagerConnectionActive; - pub struct ConnectionWrapper<'a> { - conn: Arc<SyncConnection>, - proxy: Box<dyn OrgFreedesktopNetworkManagerConnectionActive + Send + Sync + 'a>, path: Path<'a>, } impl<'a> ConnectionWrapper<'a> { - pub async fn from_path<P>(conn: Arc<SyncConnection>, path: P) -> ConnectionWrapper<'a> + pub async fn from_path<P>(path: P) -> ConnectionWrapper<'a> where P: Into<dbus::Path<'a>>, { let path = path.into(); - let proxy: Proxy<'a, Arc<SyncConnection>> = Proxy::new( - "org.freedesktop.NetworkManager", - path.clone(), - Duration::from_millis(5000), - conn.clone(), - ); - ConnectionWrapper { - conn, - proxy: Box::new(proxy), path, } } diff --git a/src/dbus_wrappers/manager_settings.rs b/src/dbus_wrappers/manager_settings.rs index f5f0308c6d9fe1ed6b5d0ff7c402cf1349b16d4b..1776208961f47f9294a9e701eb12244cce61f3c0 100644 --- a/src/dbus_wrappers/manager_settings.rs +++ b/src/dbus_wrappers/manager_settings.rs @@ -11,7 +11,6 @@ use nm_reactor_dbus_codegen::network_manager_settings::OrgFreedesktopNetworkMana use super::connection::ConnectionWrapper; pub struct ManagerSettingsWrapper<'a> { - conn: Arc<SyncConnection>, proxy: Box<dyn OrgFreedesktopNetworkManagerSettings + Send + Sync + 'a>, } @@ -25,7 +24,6 @@ impl<'a> ManagerSettingsWrapper<'a> { ); ManagerSettingsWrapper { - conn: conn.clone(), proxy: Box::new(proxy), } } @@ -40,7 +38,7 @@ impl<'a> ManagerSettingsWrapper<'a> { return Ok(None); } - let connection = ConnectionWrapper::from_path(self.conn.clone(), path).await; + let connection = ConnectionWrapper::from_path(path).await; Ok(Some(connection)) } diff --git a/src/identifier.rs b/src/identifier.rs index b85d94504ee21d0a0537db2518f1261e56bd5893..5cc7126c79b806c5d1e84d0309b04cf11d6fa2e9 100644 --- a/src/identifier.rs +++ b/src/identifier.rs @@ -66,7 +66,7 @@ impl ConnectionIdentifier { ) -> Result<Option<ConnectionWrapper<'a>>> { match self { ConnectionIdentifier::ConnectionPath { connection_path } => { - let connection = ConnectionWrapper::from_path(conn.clone(), connection_path).await; + let connection = ConnectionWrapper::from_path(connection_path).await; Ok(Some(connection)) }