diff options
author | Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com> | 2012-03-15 10:49:15 +0200 |
---|---|---|
committer | Patrik Flykt <patrik.flykt@linux.intel.com> | 2012-03-19 13:17:32 +0200 |
commit | 5f0ad0fbf6dd58ce254f5ff7d03c1dc33b2d9e14 (patch) | |
tree | bd1e48e04f145185bee96e791e253297bae50ddc | |
parent | 54167035198230e65aea2a4054d29ac67a7c8d60 (diff) | |
download | connman-5f0ad0fbf6dd58ce254f5ff7d03c1dc33b2d9e14.tar.gz connman-5f0ad0fbf6dd58ce254f5ff7d03c1dc33b2d9e14.tar.bz2 connman-5f0ad0fbf6dd58ce254f5ff7d03c1dc33b2d9e14.zip |
wispr: do not lookup for proxy if service does not provide any
-rw-r--r-- | src/wispr.c | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/src/wispr.c b/src/wispr.c index fd674dc9..a252ba6f 100644 --- a/src/wispr.c +++ b/src/wispr.c @@ -655,8 +655,18 @@ static void proxy_callback(const char *proxy, void *user_data) wispr_portal_request_portal(wp_context); } +static gboolean no_proxy_callback(gpointer user_data) +{ + struct connman_wispr_portal_context *wp_context = user_data; + + proxy_callback("DIRECT", wp_context); + + return FALSE; +} + static int wispr_portal_detect(struct connman_wispr_portal_context *wp_context) { + enum connman_service_proxy_method proxy_method; enum connman_service_type service_type; char *interface = NULL; char **nameservers = NULL; @@ -719,12 +729,19 @@ static int wispr_portal_detect(struct connman_wispr_portal_context *wp_context) for (i = 0; nameservers[i] != NULL; i++) g_web_add_nameserver(wp_context->web, nameservers[i]); - wp_context->token = connman_proxy_lookup(interface, - wp_context->status_url, - wp_context->service, - proxy_callback, wp_context); - if (wp_context->token == 0) - err = -EINVAL; + proxy_method = connman_service_get_proxy_method(wp_context->service); + + if (proxy_method != CONNMAN_SERVICE_PROXY_METHOD_DIRECT) { + wp_context->token = connman_proxy_lookup(interface, + wp_context->status_url, + wp_context->service, + proxy_callback, wp_context); + + if (wp_context->token == 0) + err = -EINVAL; + } else { + g_timeout_add_seconds(0, no_proxy_callback, wp_context); + } done: g_strfreev(nameservers); |