service: Clear service error on successfull connection attempts
authorPatrik Flykt <patrik.flykt@linux.intel.com>
Thu, 16 Aug 2012 09:20:45 +0000 (12:20 +0300)
committerPatrik Flykt <patrik.flykt@linux.intel.com>
Fri, 17 Aug 2012 10:06:29 +0000 (13:06 +0300)
Move clearing of the error to __connman_service_connect() so it is
cleared for all service connect code paths.

src/service.c

index 8ebf674..890a313 100644 (file)
@@ -4759,9 +4759,6 @@ static void request_input_cb (struct connman_service *service,
 
  done:
        if (err >= 0) {
-               /* We forget any previous error. */
-               set_error(service, CONNMAN_SERVICE_ERROR_UNKNOWN);
-
                __connman_service_connect(service);
 
                /* Never cache agent provided credentials */
@@ -5534,14 +5531,16 @@ int __connman_service_connect(struct connman_service *service)
                err = service_connect(service);
        }
 
-       if (err >= 0)
+       if (err >= 0) {
+               set_error(service, CONNMAN_SERVICE_ERROR_UNKNOWN);
                return 0;
+       }
 
        if (err == -EINPROGRESS) {
                if (service->timeout == 0)
                        service->timeout = g_timeout_add_seconds(
                                CONNECT_TIMEOUT, connect_timeout, service);
-
+               set_error(service, CONNMAN_SERVICE_ERROR_UNKNOWN);
                return -EINPROGRESS;
        }