Hi Patrik
I had to move some functions in the file for the compilation to go through.
Regards
Naveen

On Mon, Oct 26, 2015 at 8:41 PM, Naveen Singh <naveensingh0...@gmail.com>
wrote:

> From: nasingh <nasi...@nasingh-vm.roam.corp.google.com>
>
> It is been seen that if the service state has transitioned to failure
> there is no way for it to get it back to idle. This fix allows the
> state to be transitioned back to idle as part of handling clear_property
> handler for error event.
> Refer Patrik's commit 251d95755dd144c8bd6d3e3bd5d6a47f891f938f which
> fixes the documentation for transitioning out of failure state.
> ---
>  src/service.c | 74
> +++++++++++++++++++++++++++++------------------------------
>  1 file changed, 37 insertions(+), 37 deletions(-)
>
> diff --git a/src/service.c b/src/service.c
> index 02a6844..e33284d 100644
> --- a/src/service.c
> +++ b/src/service.c
> @@ -3516,6 +3516,41 @@ static void set_error(struct connman_service
> *service,
>                                 DBUS_TYPE_STRING, &str);
>  }
>
> +static void remove_timeout(struct connman_service *service)
> +{
> +       if (service->timeout > 0) {
> +               g_source_remove(service->timeout);
> +               service->timeout = 0;
> +       }
> +}
> +
> +static void reply_pending(struct connman_service *service, int error)
> +{
> +       remove_timeout(service);
> +
> +       if (service->pending) {
> +               connman_dbus_reply_pending(service->pending, error, NULL);
> +               service->pending = NULL;
> +       }
> +
> +       if (service->provider_pending) {
> +               connman_dbus_reply_pending(service->provider_pending,
> +                               error, service->path);
> +               service->provider_pending = NULL;
> +       }
> +}
> +
> +static void service_complete(struct connman_service *service)
> +{
> +       reply_pending(service, EIO);
> +
> +       if (service->connect_reason != CONNMAN_SERVICE_CONNECT_REASON_USER)
> +               __connman_service_auto_connect(service->connect_reason);
> +
> +       g_get_current_time(&service->modified);
> +       service_save(service);
> +}
> +
>
 static DBusMessage *clear_property(DBusConnection *conn,
>                                         DBusMessage *msg, void *user_data)
>  {
> @@ -3530,8 +3565,8 @@ static DBusMessage *clear_property(DBusConnection
> *conn,
>         if (g_str_equal(name, "Error")) {
>                 set_error(service, CONNMAN_SERVICE_ERROR_UNKNOWN);
>
> -               g_get_current_time(&service->modified);
> -               service_save(service);
> +               __connman_service_clear_error(service);
> +               service_complete(service);
>         } else
>                 return __connman_error_invalid_property(msg);
>
> @@ -3849,30 +3884,6 @@ static void vpn_auto_connect(void)
>                 g_timeout_add_seconds(0, run_vpn_auto_connect, NULL);
>  }
>
> -static void remove_timeout(struct connman_service *service)
> -{
> -       if (service->timeout > 0) {
> -               g_source_remove(service->timeout);
> -               service->timeout = 0;
> -       }
> -}
> -
> -static void reply_pending(struct connman_service *service, int error)
> -{
> -       remove_timeout(service);
> -
> -       if (service->pending) {
> -               connman_dbus_reply_pending(service->pending, error, NULL);
> -               service->pending = NULL;
> -       }
> -
> -       if (service->provider_pending) {
> -               connman_dbus_reply_pending(service->provider_pending,
> -                                               error, service->path);
> -               service->provider_pending = NULL;
> -       }
> -}
> -
>  bool
>  __connman_service_is_provider_pending(struct connman_service *service)
>  {
> @@ -5032,17 +5043,6 @@ void __connman_service_set_search_domains(struct
> connman_service *service,
>         searchdomain_add_all(service);
>  }
>
> -static void service_complete(struct connman_service *service)
> -{
> -       reply_pending(service, EIO);
> -
> -       if (service->connect_reason != CONNMAN_SERVICE_CONNECT_REASON_USER)
> -               __connman_service_auto_connect(service->connect_reason);
> -
> -       g_get_current_time(&service->modified);
> -       service_save(service);
> -}
> -
>  static void report_error_cb(void *user_context, bool retry,
>                                                         void *user_data)
>  {
> --
> 2.6.0.rc2.230.g3dd15c0
>
> _______________________________________________
> connman mailing list
> connman@connman.net
> https://lists.connman.net/mailman/listinfo/connman
>
_______________________________________________
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman

Reply via email to