Make sure we cancel proxy request if we got disconnected and still
waiting for proxy request.
---
 plugins/portal.c |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/plugins/portal.c b/plugins/portal.c
index d0d2383..b5df8d8 100644
--- a/plugins/portal.c
+++ b/plugins/portal.c
@@ -39,6 +39,7 @@
 #define STATUS_URL  "http://www.connman.net/online/status.html";
 
 struct server_data {
+       unsigned int token;
        GWeb *web;
        guint request_id;
 };
@@ -97,8 +98,6 @@ static void proxy_callback(const char *proxy, void *user_data)
                data->request_id = g_web_request_get(data->web, STATUS_URL,
                                                        web_result, location);
        }
-
-       connman_location_unref(location);
 }
 
 static int location_detect(struct connman_location *location)
@@ -150,9 +149,8 @@ static int location_detect(struct connman_location 
*location)
        g_web_set_user_agent(data->web, "ConnMan/%s", VERSION);
        g_web_set_close_connection(data->web, TRUE);
 
-       if (connman_proxy_lookup(interface, STATUS_URL,
-                                       proxy_callback, location) > 0)
-               connman_location_ref(location);
+       data->token = connman_proxy_lookup(interface, STATUS_URL,
+                                       proxy_callback, location);
 
        return 0;
 }
@@ -168,6 +166,9 @@ static int location_finish(struct connman_location 
*location)
        if (data->request_id > 0)
                g_web_cancel_request(data->web, data->request_id);
 
+       if (data->token > 0)
+               connman_proxy_lookup_cancel(data->token);
+
        g_web_unref(data->web);
 
        g_free(data);
-- 
1.7.2.3

_______________________________________________
connman mailing list
[email protected]
http://lists.connman.net/listinfo/connman

Reply via email to