[network-manager-openvpn/lr/multiple-vpn] trivial: move real_disconnect() and ensure_killed() up
- From: Lubomir Rintel <lkundrak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [network-manager-openvpn/lr/multiple-vpn] trivial: move real_disconnect() and ensure_killed() up
- Date: Fri, 21 Aug 2015 18:18:54 +0000 (UTC)
commit 3dcdfdd2e7ace8e5194bc9cd7ae720e31abf3929
Author: Lubomir Rintel <lkundrak v3 sk>
Date: Fri Aug 21 20:16:33 2015 +0200
trivial: move real_disconnect() and ensure_killed() up
src/nm-openvpn-service.c | 66 +++++++++++++++++++++++-----------------------
1 files changed, 33 insertions(+), 33 deletions(-)
---
diff --git a/src/nm-openvpn-service.c b/src/nm-openvpn-service.c
index 4941b21..607d9a9 100644
--- a/src/nm-openvpn-service.c
+++ b/src/nm-openvpn-service.c
@@ -1539,6 +1539,39 @@ check_need_secrets (NMSettingVpn *s_vpn, gboolean *need_secrets)
}
static gboolean
+ensure_killed (gpointer data)
+{
+ int pid = GPOINTER_TO_INT (data);
+
+ if (kill (pid, 0) == 0)
+ kill (pid, SIGKILL);
+
+ return FALSE;
+}
+
+static gboolean
+real_disconnect (NMVpnServicePlugin *plugin,
+ GError **err)
+{
+ NMOpenvpnPluginPrivate *priv = NM_OPENVPN_PLUGIN_GET_PRIVATE (plugin);
+
+ if (priv->pid) {
+ if (kill (priv->pid, SIGTERM) == 0)
+ g_timeout_add (2000, ensure_killed, GINT_TO_POINTER (priv->pid));
+ else
+ kill (priv->pid, SIGKILL);
+
+ g_message ("Terminated openvpn daemon with PID %d.", priv->pid);
+ priv->pid = 0;
+ }
+
+ g_free (priv->mgt_path);
+ priv->mgt_path = NULL;
+
+ return TRUE;
+}
+
+static gboolean
_connect_common (NMVpnServicePlugin *plugin,
NMConnection *connection,
GVariant *details,
@@ -1693,39 +1726,6 @@ real_new_secrets (NMVpnServicePlugin *plugin,
return TRUE;
}
-static gboolean
-ensure_killed (gpointer data)
-{
- int pid = GPOINTER_TO_INT (data);
-
- if (kill (pid, 0) == 0)
- kill (pid, SIGKILL);
-
- return FALSE;
-}
-
-static gboolean
-real_disconnect (NMVpnServicePlugin *plugin,
- GError **err)
-{
- NMOpenvpnPluginPrivate *priv = NM_OPENVPN_PLUGIN_GET_PRIVATE (plugin);
-
- if (priv->pid) {
- if (kill (priv->pid, SIGTERM) == 0)
- g_timeout_add (2000, ensure_killed, GINT_TO_POINTER (priv->pid));
- else
- kill (priv->pid, SIGKILL);
-
- g_message ("Terminated openvpn daemon with PID %d.", priv->pid);
- priv->pid = 0;
- }
-
- g_free (priv->mgt_path);
- priv->mgt_path = NULL;
-
- return TRUE;
-}
-
static void
nm_openvpn_plugin_init (NMOpenvpnPlugin *plugin)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]