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. ---
v2: clear timeout before proxy_callback, add timeout only if it doesn't exist src/wispr.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/wispr.c b/src/wispr.c index 7ee5188..342f974 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); @@ -787,6 +792,8 @@ static gboolean no_proxy_callback(gpointer user_data) { struct connman_wispr_portal_context *wp_context = user_data; + wp_context->timeout = 0; + proxy_callback("DIRECT", wp_context); return FALSE; @@ -875,8 +882,9 @@ static int wispr_portal_detect(struct connman_wispr_portal_context *wp_context) err = -EINVAL; free_connman_wispr_portal_context(wp_context); } - } else { - g_timeout_add_seconds(0, no_proxy_callback, wp_context); + } else if (wp_context->timeout == 0) { + 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