From 9e5d27963b3bf1b0a2d76ef165616fdfaf58b825 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Thu, 29 Nov 2012 20:07:31 -0600 Subject: Fix various performance and stability issues in the network-manager backend --- .../network-manager/network-manager.cpp | 31 +++++++++++++++++++++- .../network-manager/network-manager.h | 1 + 2 files changed, 31 insertions(+), 1 deletion(-) (limited to 'tdecore/networkbackends/network-manager') diff --git a/tdecore/networkbackends/network-manager/network-manager.cpp b/tdecore/networkbackends/network-manager/network-manager.cpp index 05aa97618..e0b11481c 100644 --- a/tdecore/networkbackends/network-manager/network-manager.cpp +++ b/tdecore/networkbackends/network-manager/network-manager.cpp @@ -1332,7 +1332,7 @@ void TDENetworkConnectionManager_BackendNM_DBusSignalReceiver::dbusSignal(const TQString member = message.member(); TQString path = message.path(); -// printf("[DEBUG] In dbusSignal: sender: %s, member: %s, interface: %s, path: %s\n\r", sender.ascii(), member.ascii(), interface.ascii(), path.ascii()); fflush(stdout); +// printf("[DEBUG] In dbusSignal: sender: %s, member: %s, interface: %s, path: %s, parent path: %s\n\r", sender.ascii(), member.ascii(), interface.ascii(), path.ascii(), m_parent->m_dbusDeviceString.ascii()); fflush(stdout); if (interface == NM_VPN_DBUS_CONNECTION_SERVICE) { if (member == "VpnStateChanged") { @@ -1711,6 +1711,31 @@ TDENetworkDeviceInformation TDENetworkConnectionManager_BackendNM::deviceInforma return ret; } +TDENetworkDeviceInformation TDENetworkConnectionManager_BackendNM::deviceStatus() { + TQT_DBusError error; + TDENetworkDeviceInformation ret; + + if (d->m_networkDeviceProxy) { + ret.statusFlags = nmDeviceStateToTDEDeviceState(d->m_networkDeviceProxy->getState(error)); + ret.UUID = d->m_networkDeviceProxy->getUdi(error); + + // Get active connection UUID + TQT_DBusObjectPath connectionPath = d->m_networkDeviceProxy->getActiveConnection(error); + if (!error.isValid()) { + DBus::ActiveConnectionProxy activeConnection(NM_DBUS_SERVICE, connectionPath); + activeConnection.setConnection(TQT_DBusConnection::systemBus()); + ret.activeConnectionUUID = activeConnection.getUuid(error); + if (!error.isValid()) { + ret.activeConnectionUUID = TQString::null; + } + } + + ret.valid = true; + } + + return ret; +} + void TDENetworkConnectionManager_BackendNMPrivate::processConnectionSettingsAsyncReply(int asyncCallId, const TQT_DBusDataMap& settings) { nmConnectionSettingsAsyncCallWaiting[asyncCallId] = false; nmConnectionSettingsAsyncSettingsResponse[asyncCallId] = settings; @@ -4660,7 +4685,9 @@ TDENetworkConnectionStatus::TDENetworkConnectionStatus TDENetworkConnectionManag } return checkConnectionStatus(uuid); #else // USE_ASYNC_DBUS_CONNECTION_COMMAND_CALLS +#ifdef WAIT_FOR_OPERATION_BEFORE_RETURNING connect(d->m_networkManagerProxy, SIGNAL(ActivateConnectionAsyncReply(int, const TQT_DBusObjectPath&)), d, SLOT(processAddConnectionAsyncReply(int, const TQT_DBusObjectPath&))); +#endif // WAIT_FOR_OPERATION_BEFORE_RETURNING int asyncCallID; ret = d->m_networkManagerProxy->ActivateConnectionAsync(asyncCallID, existingConnection, TQT_DBusObjectPath(d->m_dbusDeviceString.ascii()), TQT_DBusObjectPath("/"), error); if (ret && error.isValid()) { @@ -4841,7 +4868,9 @@ TDENetworkConnectionStatus::TDENetworkConnectionStatus TDENetworkConnectionManag } return checkConnectionStatus(uuid); #else // USE_ASYNC_DBUS_CONNECTION_COMMAND_CALLS +#ifdef WAIT_FOR_OPERATION_BEFORE_RETURNING connect(d->m_networkManagerProxy, SIGNAL(DeactivateConnectionAsyncReply(int)), d, SLOT(processConnectionSettingsUpdateAsyncReply(int))); +#endif // WAIT_FOR_OPERATION_BEFORE_RETURNING int asyncCallID; ret = d->m_networkManagerProxy->DeactivateConnectionAsync(asyncCallID, existingConnection, error); if (ret && error.isValid()) { diff --git a/tdecore/networkbackends/network-manager/network-manager.h b/tdecore/networkbackends/network-manager/network-manager.h index f06643b6e..2063a036b 100644 --- a/tdecore/networkbackends/network-manager/network-manager.h +++ b/tdecore/networkbackends/network-manager/network-manager.h @@ -159,6 +159,7 @@ class TDECORE_EXPORT TDENetworkConnectionManager_BackendNM : public TDENetworkCo virtual TDENetworkDeviceType::TDENetworkDeviceType deviceType(); virtual TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags backendStatus(); virtual TDENetworkDeviceInformation deviceInformation(); + virtual TDENetworkDeviceInformation deviceStatus(); virtual void loadConnectionInformation(); virtual void loadConnectionAllowedValues(TDENetworkConnection* connection); -- cgit v1.2.1