Add error reporting to network-manager backend

Fix inability to create new wireless connections
pull/16/head
Timothy Pearson 12 years ago
parent 47a706a785
commit 0f6250882c

@ -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);

@ -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;
};

Loading…
Cancel
Save