summaryrefslogtreecommitdiff
path: root/vpn/vpn-provider.c
diff options
context:
space:
mode:
authorJukka Rissanen <jukka.rissanen@linux.intel.com>2013-02-13 17:29:05 +0200
committerPatrik Flykt <patrik.flykt@linux.intel.com>2013-02-19 12:51:48 +0200
commit856cd655111100c095be6496f85a0dc14d3d13c2 (patch)
treeadd651a91b50586bef915ede7e822dcbf627b114 /vpn/vpn-provider.c
parent2908f0a0546a58e02cb49492b0d7118a4f910870 (diff)
downloadconnman-856cd655111100c095be6496f85a0dc14d3d13c2.tar.gz
connman-856cd655111100c095be6496f85a0dc14d3d13c2.tar.bz2
connman-856cd655111100c095be6496f85a0dc14d3d13c2.zip
vpn-provider: Go internally into IDLE after FAILURE
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.
Diffstat (limited to 'vpn/vpn-provider.c')
-rw-r--r--vpn/vpn-provider.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/vpn/vpn-provider.c b/vpn/vpn-provider.c
index 2519dd52..0046ea7f 100644
--- a/vpn/vpn-provider.c
+++ b/vpn/vpn-provider.c
@@ -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;
}