Allow service removal to clear failure state
authorMarcel Holtmann <marcel@holtmann.org>
Sat, 5 Dec 2009 14:23:11 +0000 (15:23 +0100)
committerMarcel Holtmann <marcel@holtmann.org>
Sat, 5 Dec 2009 14:23:11 +0000 (15:23 +0100)
doc/service-api.txt
src/service.c

index b4b60a7..ddf7f16 100644 (file)
@@ -74,6 +74,10 @@ Methods              dict GetProperties()
                        This is similar to setting the Favorite property
                        to false, but that is currently not supported.
 
+                       In the case a connection attempt failed and the
+                       service is in the State=failure, this method can
+                       also be used to reset the service.
+
                        Calling this method on Ethernet devices will cause
                        an error message. It is not possible to remove these
                        kind of devices.
index 5a941bb..9caa505 100644 (file)
@@ -1071,7 +1071,8 @@ static DBusMessage *remove_service(DBusConnection *conn,
        if (service->type == CONNMAN_SERVICE_TYPE_ETHERNET)
                return __connman_error_not_supported(msg);
 
-       if (service->favorite == FALSE)
+       if (service->favorite == FALSE &&
+                       service->state != CONNMAN_SERVICE_STATE_FAILURE)
                return __connman_error_not_supported(msg);
 
        if (service->network != NULL) {
@@ -1096,6 +1097,8 @@ static DBusMessage *remove_service(DBusConnection *conn,
 
        apn_changed(service);
 
+       set_idle(service);
+
        connman_service_set_favorite(service, FALSE);
        __connman_storage_save_service(service);