summaryrefslogtreecommitdiffstats
path: root/tdecore/networkbackends
diff options
context:
space:
mode:
authorTimothy Pearson <[email protected]>2013-05-18 00:24:59 -0500
committerTimothy Pearson <[email protected]>2013-05-18 00:24:59 -0500
commit0f6250882c0329bc864a4401f65e21b744962234 (patch)
tree699022eaf92e8392d4c098dd9f3a6f2905d764b7 /tdecore/networkbackends
parent47a706a785ee2497fd7ebcf8176364a09f23ae07 (diff)
downloadtdelibs-0f6250882c0329bc864a4401f65e21b744962234.tar.gz
tdelibs-0f6250882c0329bc864a4401f65e21b744962234.zip
Add error reporting to network-manager backend
Fix inability to create new wireless connections
Diffstat (limited to 'tdecore/networkbackends')
-rw-r--r--tdecore/networkbackends/network-manager/network-manager.cpp84
-rw-r--r--tdecore/networkbackends/network-manager/network-manager_p.h9
2 files changed, 81 insertions, 12 deletions
diff --git a/tdecore/networkbackends/network-manager/network-manager.cpp b/tdecore/networkbackends/network-manager/network-manager.cpp
index b56111c61..ce12367e7 100644
--- a/tdecore/networkbackends/network-manager/network-manager.cpp
+++ b/tdecore/networkbackends/network-manager/network-manager.cpp
@@ -1577,8 +1577,14 @@ TDENetworkConnectionType::TDENetworkConnectionType TDENetworkConnectionManager_B
}
}
TQT_DBusTQStringDataMap connectionSettingsMap = d->nmConnectionSettingsAsyncSettingsResponse[asyncCallID];
+ if (d->nmConnectionSettingsAsyncSettingsErrorResponse.contains(asyncCallID)) {
+ PRINT_ERROR((d->nmConnectionSettingsAsyncSettingsErrorResponse[asyncCallID].name() + ": " + d->nmConnectionSettingsAsyncSettingsErrorResponse[asyncCallID].message()));
+ d->nmConnectionSettingsAsyncSettingsErrorResponse.remove(asyncCallID);
+ }
d->nmConnectionSettingsAsyncCallWaiting.remove(asyncCallID);
- d->nmConnectionSettingsAsyncSettingsResponse.remove(asyncCallID);
+ if (d->nmConnectionSettingsAsyncSettingsResponse.contains(asyncCallID)) {
+ d->nmConnectionSettingsAsyncSettingsResponse.remove(asyncCallID);
+ }
#endif // USE_ASYNC_DBUS_CALLS
// Parse settings to find connection type
@@ -1750,6 +1756,18 @@ void TDENetworkConnectionManager_BackendNMPrivate::processAddConnectionAsyncRepl
nmAddConnectionAsyncResponse[asyncCallId] = path;
}
+void TDENetworkConnectionManager_BackendNMPrivate::processConnectionSettingsAsyncError(int asyncCallId, const TQT_DBusError error) {
+ nmConnectionSettingsAsyncSettingsErrorResponse[asyncCallId] = error;
+}
+
+void TDENetworkConnectionManager_BackendNMPrivate::processConnectionSettingsUpdateAsyncError(int asyncCallId, const TQT_DBusError error) {
+ nmConnectionSettingsUpdateAsyncSettingsErrorResponse[asyncCallId] = error;
+}
+
+void TDENetworkConnectionManager_BackendNMPrivate::processAddConnectionAsyncError(int asyncCallId, const TQT_DBusError error) {
+ nmAddConnectionAsyncErrorResponse[asyncCallId] = error;
+}
+
void TDENetworkConnectionManager_BackendNM::loadConnectionInformation() {
if (d->nonReentrantCallActive) return;
@@ -1843,6 +1861,7 @@ void TDENetworkConnectionManager_BackendNM::loadConnectionInformation() {
DBus::ConnectionSettingsInterface connectionSettings(NM_DBUS_SERVICE, (*it));
connectionSettings.setConnection(TQT_DBusConnection::systemBus());
connect(&connectionSettings, SIGNAL(GetSettingsAsyncReply(int, const TQT_DBusDataMap<TQString>&)), d, SLOT(processConnectionSettingsAsyncReply(int, const TQT_DBusDataMap<TQString>&)));
+ connect(&connectionSettings, SIGNAL(AsyncErrorResponseDetected(int, const TQT_DBusError)), d, SLOT(processConnectionSettingsAsyncError(int, const TQT_DBusError)));
int asyncCallID;
ret = connectionSettings.GetSettingsAsync(asyncCallID, error);
if (ret && error.isValid()) {
@@ -1862,8 +1881,14 @@ void TDENetworkConnectionManager_BackendNM::loadConnectionInformation() {
}
}
TQT_DBusTQStringDataMap connectionSettingsMap = d->nmConnectionSettingsAsyncSettingsResponse[asyncCallID];
+ if (d->nmConnectionSettingsAsyncSettingsErrorResponse.contains(asyncCallID)) {
+ PRINT_ERROR((d->nmConnectionSettingsAsyncSettingsErrorResponse[asyncCallID].name() + ": " + d->nmConnectionSettingsAsyncSettingsErrorResponse[asyncCallID].message()));
+ d->nmConnectionSettingsAsyncSettingsErrorResponse.remove(asyncCallID);
+ }
d->nmConnectionSettingsAsyncCallWaiting.remove(asyncCallID);
- d->nmConnectionSettingsAsyncSettingsResponse.remove(asyncCallID);
+ if (d->nmConnectionSettingsAsyncSettingsResponse.contains(asyncCallID)) {
+ d->nmConnectionSettingsAsyncSettingsResponse.remove(asyncCallID);
+ }
#endif // USE_ASYNC_DBUS_CALLS
#ifdef DEBUG_NETWORK_MANAGER_COMMUNICATIONS
@@ -2994,8 +3019,14 @@ bool TDENetworkConnectionManager_BackendNM::loadConnectionSecretsForGroup(TQStri
}
}
connectionSecretsMap = d->nmConnectionSettingsAsyncSettingsResponse[asyncCallID];
+ if (d->nmConnectionSettingsAsyncSettingsErrorResponse.contains(asyncCallID)) {
+ PRINT_ERROR((d->nmConnectionSettingsAsyncSettingsErrorResponse[asyncCallID].name() + ": " + d->nmConnectionSettingsAsyncSettingsErrorResponse[asyncCallID].message()));
+ d->nmConnectionSettingsAsyncSettingsErrorResponse.remove(asyncCallID);
+ }
d->nmConnectionSettingsAsyncCallWaiting.remove(asyncCallID);
- d->nmConnectionSettingsAsyncSettingsResponse.remove(asyncCallID);
+ if (d->nmConnectionSettingsAsyncSettingsResponse.contains(asyncCallID)) {
+ d->nmConnectionSettingsAsyncSettingsResponse.remove(asyncCallID);
+ }
#endif // USE_ASYNC_DBUS_CALLS
#ifdef DEBUG_NETWORK_MANAGER_COMMUNICATIONS
@@ -3132,6 +3163,7 @@ bool TDENetworkConnectionManager_BackendNM::loadConnectionSecretsForGroup(TQStri
bool TDENetworkConnectionManager_BackendNM::saveConnection(TDENetworkConnection* connection) {
bool timed_out = FALSE;
+ bool command_failed = FALSE;
if (!connection) {
PRINT_ERROR(TQString("connection cannot be NULL!"));
@@ -3174,7 +3206,6 @@ bool TDENetworkConnectionManager_BackendNM::saveConnection(TDENetworkConnection*
// Obtain connection settings from the path specified
DBus::ConnectionSettingsInterface connectionSettings(NM_DBUS_SERVICE, existingConnection);
connectionSettings.setConnection(TQT_DBusConnection::systemBus());
- connectionSettingsMap;
ret = connectionSettings.GetSettings(connectionSettingsMap, error);
if (ret && error.isValid()) {
ret = 0;
@@ -3206,8 +3237,14 @@ bool TDENetworkConnectionManager_BackendNM::saveConnection(TDENetworkConnection*
}
}
connectionSettingsMap = d->nmConnectionSettingsAsyncSettingsResponse[asyncCallID];
+ if (d->nmConnectionSettingsAsyncSettingsErrorResponse.contains(asyncCallID)) {
+ PRINT_ERROR((d->nmConnectionSettingsAsyncSettingsErrorResponse[asyncCallID].name() + ": " + d->nmConnectionSettingsAsyncSettingsErrorResponse[asyncCallID].message()));
+ d->nmConnectionSettingsAsyncSettingsErrorResponse.remove(asyncCallID);
+ }
d->nmConnectionSettingsAsyncCallWaiting.remove(asyncCallID);
- d->nmConnectionSettingsAsyncSettingsResponse.remove(asyncCallID);
+ if (d->nmConnectionSettingsAsyncSettingsResponse.contains(asyncCallID)) {
+ d->nmConnectionSettingsAsyncSettingsResponse.remove(asyncCallID);
+ }
#endif // USE_ASYNC_DBUS_CALLS
existing = true;
}
@@ -3712,7 +3749,9 @@ bool TDENetworkConnectionManager_BackendNM::saveConnection(TDENetworkConnection*
settingsMap["key-mgmt"] = convertDBUSDataToVariantData(TQT_DBusData::fromString(tdeWiFiKeyTypeToNMWiFiKeyType(wiFiConnection->securitySettings.keyType)));
}
else {
- settingsMap.remove("key-mgmt");
+ // The key-mgmt entry seems to be required even if no security is available and/or enabled!
+ // settingsMap.remove("key-mgmt");
+ settingsMap["key-mgmt"] = convertDBUSDataToVariantData(TQT_DBusData::fromString("none"));
}
}
if (wiFiConnection->securitySettings.wepKeyIndex > 0) {
@@ -4431,6 +4470,7 @@ bool TDENetworkConnectionManager_BackendNM::saveConnection(TDENetworkConnection*
#endif // DEBUG_NETWORK_MANAGER_COMMUNICATIONS
// Create new connection
connect(d->m_networkManagerSettings, SIGNAL(AddConnectionAsyncReply(int, const TQT_DBusObjectPath&)), d, SLOT(processAddConnectionAsyncReply(int, const TQT_DBusObjectPath&)));
+ connect(d->m_networkManagerSettings, SIGNAL(AsyncErrorResponseDetected(int, const TQT_DBusError)), d, SLOT(processAddConnectionAsyncError(int, const TQT_DBusError)));
int asyncCallID;
ret = d->m_networkManagerSettings->AddConnectionAsync(asyncCallID, connectionSettingsMap, error);
if (ret && error.isValid()) {
@@ -4450,9 +4490,19 @@ bool TDENetworkConnectionManager_BackendNM::saveConnection(TDENetworkConnection*
}
tqApp->processEvents();
}
+ if (d->nmAddConnectionAsyncErrorResponse.contains(asyncCallID)) {
+ PRINT_ERROR((d->nmAddConnectionAsyncErrorResponse[asyncCallID].name() + ": " + d->nmAddConnectionAsyncErrorResponse[asyncCallID].message()));
+ d->nmAddConnectionAsyncErrorResponse.remove(asyncCallID);
+ }
+ if (!d->nmAddConnectionAsyncResponse[asyncCallID].data()) {
+ PRINT_ERROR(TQString("NetworkManager did not return a new connection object!"))
+ command_failed = true;
+ }
d->nmConnectionSettingsAsyncCallWaiting.remove(asyncCallID);
- d->nmAddConnectionAsyncResponse.remove(asyncCallID);
- return !timed_out;
+ if (d->nmAddConnectionAsyncResponse.contains(asyncCallID)) {
+ d->nmAddConnectionAsyncResponse.remove(asyncCallID);
+ }
+ return ((!timed_out) && (!command_failed));
}
else {
// Error!
@@ -4674,6 +4724,7 @@ TDENetworkConnectionStatus::TDENetworkConnectionStatus TDENetworkConnectionManag
TQT_DBusObjectPath existingConnection;
TQT_DBusError error;
bool ret;
+ bool command_failed = FALSE;
if ((d->m_networkManagerSettings) && (d->m_networkManagerProxy)) {
ret = d->m_networkManagerSettings->GetConnectionByUuid(uuid, existingConnection, error);
if (ret) {
@@ -4694,6 +4745,7 @@ TDENetworkConnectionStatus::TDENetworkConnectionStatus TDENetworkConnectionManag
#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&)));
+ connect(d->m_networkManagerProxy, SIGNAL(AsyncErrorResponseDetected(int, const TQT_DBusError)), d, SLOT(processAddConnectionAsyncError(int, const TQT_DBusError)));
#endif // WAIT_FOR_OPERATION_BEFORE_RETURNING
int asyncCallID;
ret = d->m_networkManagerProxy->ActivateConnectionAsync(asyncCallID, existingConnection, TQT_DBusObjectPath(d->m_dbusDeviceString.ascii()), TQT_DBusObjectPath("/"), error);
@@ -4715,13 +4767,23 @@ TDENetworkConnectionStatus::TDENetworkConnectionStatus TDENetworkConnectionManag
tqApp->processEvents();
}
d->nmConnectionSettingsAsyncCallWaiting.remove(asyncCallID);
- d->nmAddConnectionAsyncResponse.remove(asyncCallID);
- return checkConnectionStatus(uuid);
+ if (d->nmAddConnectionAsyncErrorResponse.contains(asyncCallID)) {
+ PRINT_ERROR((d->nmAddConnectionAsyncErrorResponse[asyncCallID].name() + ": " + d->nmAddConnectionAsyncErrorResponse[asyncCallID].message()));
+ d->nmAddConnectionAsyncErrorResponse.remove(asyncCallID);
+ }
+ if (!d->nmAddConnectionAsyncResponse[asyncCallID].data()) {
+ PRINT_ERROR(TQString("NetworkManager did not return a new connection object!"))
+ command_failed = true;
+ }
+ if (d->nmAddConnectionAsyncResponse.contains(asyncCallID)) {
+ d->nmAddConnectionAsyncResponse.remove(asyncCallID);
+ }
+ return ((!command_failed) && checkConnectionStatus(uuid));
}
else {
// Error!
PRINT_ERROR(error.name())
- return checkConnectionStatus(uuid);
+ return ((!command_failed) && checkConnectionStatus(uuid));
}
#else
return checkConnectionStatus(uuid);
diff --git a/tdecore/networkbackends/network-manager/network-manager_p.h b/tdecore/networkbackends/network-manager/network-manager_p.h
index 0e1fe4de8..983107949 100644
--- a/tdecore/networkbackends/network-manager/network-manager_p.h
+++ b/tdecore/networkbackends/network-manager/network-manager_p.h
@@ -62,6 +62,7 @@ typedef TQValueList<TQT_DBusData> TQT_DBusDataValueList;
typedef TQMap<uint, bool> NMAsyncCallIDMap;
typedef TQMap<uint, TQT_DBusTQStringDataMap> NMAsyncSettingsResponseMap;
typedef TQMap<uint, TQT_DBusObjectPath> NMAddConnectionAsyncResponseMap;
+typedef TQMap<uint, TQT_DBusError> NMAddConnectionAsyncErrorResponseMap;
typedef TQValueList<TQT_DBusObjectPath> TQT_DBusObjectPathList;
@@ -100,6 +101,9 @@ class TDENetworkConnectionManager_BackendNMPrivate : public TQObject
NMAsyncCallIDMap nmConnectionSettingsAsyncCallWaiting;
NMAsyncSettingsResponseMap nmConnectionSettingsAsyncSettingsResponse;
NMAddConnectionAsyncResponseMap nmAddConnectionAsyncResponse;
+ NMAddConnectionAsyncErrorResponseMap nmConnectionSettingsAsyncSettingsErrorResponse;
+ NMAddConnectionAsyncErrorResponseMap nmConnectionSettingsUpdateAsyncSettingsErrorResponse;
+ NMAddConnectionAsyncErrorResponseMap nmAddConnectionAsyncErrorResponse;
bool nonReentrantCallActive;
TQString m_dbusDeviceString;
@@ -107,6 +111,9 @@ class TDENetworkConnectionManager_BackendNMPrivate : public TQObject
void processConnectionSettingsAsyncReply(int, const TQT_DBusDataMap<TQString>&);
void processConnectionSettingsUpdateAsyncReply(int);
void processAddConnectionAsyncReply(int, const TQT_DBusObjectPath&);
+ void processConnectionSettingsAsyncError(int, const TQT_DBusError);
+ void processConnectionSettingsUpdateAsyncError(int, const TQT_DBusError);
+ void processAddConnectionAsyncError(int, const TQT_DBusError);
void internalProcessGlobalStateChanged(TQ_UINT32 state);
void internalProcessVPNStateChanged(TQ_UINT32 state);
@@ -123,7 +130,7 @@ class TDENetworkConnectionManager_BackendNMPrivate : public TQObject
TQMap<TQString, DBus::AccessPointProxy*> m_accessPointProxyList;
TQT_DBusConnection *m_dbusSignalConnection;
TDENetworkConnectionManager_BackendNM_DBusSignalReceiver *m_dbusSignalReceiver;
- int m_prevDeviceState;
+ TQ_UINT32 m_prevDeviceState;
friend class TDENetworkConnectionManager_BackendNM_DBusSignalReceiver;
};