From: Patrik Flykt <patrik.fl...@linux.intel.com>

Keep track of the zero-second no proxy callback timeout and remove
it when freeing up the WISPr context.
---
 src/wispr.c |    9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/wispr.c b/src/wispr.c
index 7ee5188..eede9ee 100644
--- a/src/wispr.c
+++ b/src/wispr.c
@@ -83,6 +83,8 @@ struct connman_wispr_portal_context {
        enum connman_wispr_result wispr_result;
 
        GSList *route_list;
+
+       guint timeout;
 };
 
 struct connman_wispr_portal {
@@ -174,6 +176,9 @@ static void free_connman_wispr_portal_context(struct 
connman_wispr_portal_contex
        if (wp_context->request_id > 0)
                g_web_cancel_request(wp_context->web, wp_context->request_id);
 
+       if (wp_context->timeout > 0)
+               g_source_remove(wp_context->timeout);
+
        if (wp_context->web != NULL)
                g_web_unref(wp_context->web);
 
@@ -789,6 +794,7 @@ static gboolean no_proxy_callback(gpointer user_data)
 
        proxy_callback("DIRECT", wp_context);
 
+       wp_context->timeout = 0;
        return FALSE;
 }
 
@@ -876,7 +882,8 @@ static int wispr_portal_detect(struct 
connman_wispr_portal_context *wp_context)
                        free_connman_wispr_portal_context(wp_context);
                }
        } else {
-               g_timeout_add_seconds(0, no_proxy_callback, wp_context);
+               wp_context->timeout =
+                       g_timeout_add_seconds(0, no_proxy_callback, wp_context);
        }
 
 done:
-- 
1.7.10.4

_______________________________________________
connman mailing list
connman@connman.net
http://lists.connman.net/listinfo/connman

Reply via email to