vpn-provider: Go internally into IDLE after FAILURE
authorJukka Rissanen <jukka.rissanen@linux.intel.com>
Wed, 13 Feb 2013 15:29:05 +0000 (17:29 +0200)
committerPatrik Flykt <patrik.flykt@linux.intel.com>
Tue, 19 Feb 2013 10:51:48 +0000 (12:51 +0200)
Do not stay in FAILURE state as clients like connmand can
get confused about our current state. Symptom for the problem
is that after a failed connect attempt, a new connect attempt
by the client would cause immediately a failure return code
because vpnd is still in FAILURE state. The actual connect
attempt might still succeed but then the client would not
know about the success status.
By setting the state to IDLE we avoid this confusion.

vpn/vpn-provider.c

index 2519dd5..0046ea7 100644 (file)
@@ -1204,6 +1204,13 @@ static int provider_indicate_state(struct vpn_provider *provider,
        connman_dbus_property_changed_basic(provider->path,
                                        VPN_CONNECTION_INTERFACE, "State",
                                        DBUS_TYPE_STRING, &str);
+       /*
+        * We do not stay in failure state as clients like connmand can
+        * get confused about our current state.
+        */
+       if (provider->state == VPN_PROVIDER_STATE_FAILURE)
+               provider->state = VPN_PROVIDER_STATE_IDLE;
+
        return 0;
 }