[network-manager-openswan/nm-1-0] service: unhook the retry upon cleanup



commit 09dabbd1d0ac1391cc8cea49cf8f4a3147dcf085
Author: Lubomir Rintel <lkundrak v3 sk>
Date:   Thu Aug 27 15:33:04 2015 +0200

    service: unhook the retry upon cleanup
    
    Fixes: 85f14e2e7084c08f233c1ad034e0108439f770bc
    (cherry picked from commit 2b8a71d3b89a41ffed8341f358df5c1c1489a49c)

 src/nm-openswan-service.c |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)
---
diff --git a/src/nm-openswan-service.c b/src/nm-openswan-service.c
index 6b643d6..487d0d4 100644
--- a/src/nm-openswan-service.c
+++ b/src/nm-openswan-service.c
@@ -88,6 +88,7 @@ typedef struct {
 
        GPid pid;
        guint watch_id;
+       guint retry_id;
        guint retries;
        ConnectStep connect_step;
        NMConnection *connection;
@@ -368,6 +369,11 @@ connect_cleanup (NMOpenSwanPlugin *self)
                priv->pid = 0;
        }
 
+       if (priv->watch_id) {
+               g_source_remove (priv->watch_id);
+               priv->watch_id = 0;
+       }
+
        if (priv->io_id) {
                g_source_remove (priv->io_id);
                priv->io_id = 0;
@@ -449,8 +455,11 @@ static gboolean
 retry_cb (gpointer user_data)
 {
        NMOpenSwanPlugin *self = NM_OPENSWAN_PLUGIN (user_data);
+       NMOpenSwanPluginPrivate *priv = NM_OPENSWAN_PLUGIN_GET_PRIVATE (self);
        GError *error = NULL;
 
+       priv->retry_id = 0;
+
        if (!connect_step (self, &error))
                connect_failed (self, TRUE, error, NM_VPN_PLUGIN_FAILURE_CONNECT_FAILED);
        g_clear_error (&error);
@@ -491,7 +500,7 @@ child_watch_cb (GPid pid, gint status, gpointer user_data)
        if (ret != 0 && priv->retries) {
                priv->retries--;
                g_message ("Spawn: %d more tries...", priv->retries);
-               g_timeout_add (100, retry_cb, self);
+               priv->retry_id = g_timeout_add (100, retry_cb, self);
                return;
        }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]