summaryrefslogtreecommitdiff
path: root/vpn/vpn-provider.c
diff options
context:
space:
mode:
authorJukka Rissanen <jukka.rissanen@linux.intel.com>2012-11-12 14:07:52 +0200
committerPatrik Flykt <patrik.flykt@linux.intel.com>2012-11-23 12:58:52 +0200
commit4b68388a8c617c88e28ab7c3fa7c7fca9b439c68 (patch)
tree3137067a48a48c70326a0fa79f09902fe8f57018 /vpn/vpn-provider.c
parent64308ada36e2d65610a2431e67b67d2ad7abe98c (diff)
downloadconnman-4b68388a8c617c88e28ab7c3fa7c7fca9b439c68.tar.gz
connman-4b68388a8c617c88e28ab7c3fa7c7fca9b439c68.tar.bz2
connman-4b68388a8c617c88e28ab7c3fa7c7fca9b439c68.zip
vpnd: Add function that quits vpnd if no VPN configurations are found
Diffstat (limited to 'vpn/vpn-provider.c')
-rw-r--r--vpn/vpn-provider.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/vpn/vpn-provider.c b/vpn/vpn-provider.c
index 27783bc2..a69b458e 100644
--- a/vpn/vpn-provider.c
+++ b/vpn/vpn-provider.c
@@ -2109,6 +2109,28 @@ void vpn_provider_driver_unregister(struct vpn_provider_driver *driver)
driver_list = g_slist_remove(driver_list, driver);
}
+static gboolean check_vpn_count(gpointer data)
+{
+ if (configuration_count == 0) {
+ connman_info("No VPN configurations found, quitting.");
+ raise(SIGTERM);
+ }
+
+ return FALSE;
+}
+
+void __vpn_provider_check_connections(void)
+{
+ /*
+ * If we were started when there is no providers configured,
+ * then just quit. This happens when connman starts and its
+ * vpn plugin asks connman-vpnd if it has any connections
+ * configured. If there are none, then we can stop the vpn
+ * daemon.
+ */
+ g_timeout_add(1000, check_vpn_count, NULL);
+}
+
int __vpn_provider_init(gboolean do_routes)
{
DBG("");