[network-manager-openvpn/lr/multiple-vpn] service: disconnect when NM connects and drops off the bus
- From: Lubomir Rintel <lkundrak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [network-manager-openvpn/lr/multiple-vpn] service: disconnect when NM connects and drops off the bus
- Date: Wed, 23 Sep 2015 11:15:56 +0000 (UTC)
commit bd1cbed8a947efea34aa314a982940889ee906bc
Author: Lubomir Rintel <lkundrak v3 sk>
Date: Wed Sep 23 12:33:46 2015 +0200
service: disconnect when NM connects and drops off the bus
src/nm-openvpn-service.c | 17 +++++++++++++----
src/nm-openvpn-service.h | 2 +-
2 files changed, 14 insertions(+), 5 deletions(-)
---
diff --git a/src/nm-openvpn-service.c b/src/nm-openvpn-service.c
index 08f3104..f83052f 100644
--- a/src/nm-openvpn-service.c
+++ b/src/nm-openvpn-service.c
@@ -1778,13 +1778,14 @@ plugin_state_changed (NMOpenvpnPlugin *plugin,
}
NMOpenvpnPlugin *
-nm_openvpn_plugin_new (const char *bus_name)
+nm_openvpn_plugin_new (const char *bus_name, gboolean watch_peer)
{
NMOpenvpnPlugin *plugin;
GError *error = NULL;
plugin = (NMOpenvpnPlugin *) g_initable_new (NM_TYPE_OPENVPN_PLUGIN, NULL, &error,
NM_VPN_SERVICE_PLUGIN_DBUS_SERVICE_NAME, bus_name,
+ NM_VPN_SERVICE_PLUGIN_DBUS_WATCH_PEER, watch_peer,
NULL);
if (plugin) {
@@ -1830,7 +1831,8 @@ main (int argc, char *argv[])
NMOpenvpnPlugin *plugin;
gboolean persist = FALSE;
GOptionContext *opt_ctx = NULL;
- gchar *bus_name = NM_DBUS_SERVICE_OPENVPN;
+ gchar *bus_name = NULL;
+ gboolean watch_peer = TRUE;
GError *error = NULL;
GOptionEntry options[] = {
@@ -1873,14 +1875,21 @@ main (int argc, char *argv[])
if (getenv ("OPENVPN_DEBUG"))
debug = TRUE;
- if (debug)
+ if (debug) {
g_message ("nm-openvpn-service (version " DIST_VERSION ") starting...");
+ watch_peer = FALSE;
+ }
if ( !g_file_test ("/sys/class/misc/tun", G_FILE_TEST_EXISTS)
&& (system ("/sbin/modprobe tun") == -1))
exit (EXIT_FAILURE);
- plugin = nm_openvpn_plugin_new (bus_name);
+ if (!bus_name) {
+ watch_peer = FALSE;
+ bus_name = NM_DBUS_SERVICE_OPENVPN;
+ }
+
+ plugin = nm_openvpn_plugin_new (bus_name, watch_peer);
if (!plugin)
exit (EXIT_FAILURE);
diff --git a/src/nm-openvpn-service.h b/src/nm-openvpn-service.h
index df2ce60..92bd86d 100644
--- a/src/nm-openvpn-service.h
+++ b/src/nm-openvpn-service.h
@@ -46,6 +46,6 @@ typedef struct {
GType nm_openvpn_plugin_get_type (void);
-NMOpenvpnPlugin *nm_openvpn_plugin_new (const char *bus_name);
+NMOpenvpnPlugin *nm_openvpn_plugin_new (const char *bus_name, gboolean watch_peer);
#endif /* NM_OPENVPN_SERVICE_H */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]