summaryrefslogtreecommitdiff
path: root/src/wispr.c
diff options
context:
space:
mode:
authorTomasz Bursztyka <tomasz.bursztyka@linux.intel.com>2011-10-17 16:51:31 +0300
committerSamuel Ortiz <sameo@linux.intel.com>2011-10-21 00:26:11 +0200
commit05f526ba37fee56db7319e5dd3c2e9d6b5d88ea4 (patch)
tree356f66c904c78f81e1dbac6783f054b84025eac6 /src/wispr.c
parent998127d6cb03149c4ea2f4bcd200e81a5adc86e3 (diff)
downloadconnman-05f526ba37fee56db7319e5dd3c2e9d6b5d88ea4.tar.gz
connman-05f526ba37fee56db7319e5dd3c2e9d6b5d88ea4.tar.bz2
connman-05f526ba37fee56db7319e5dd3c2e9d6b5d88ea4.zip
wispr: wispr_start will always re-start a new context
Diffstat (limited to 'src/wispr.c')
-rw-r--r--src/wispr.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/wispr.c b/src/wispr.c
index 7cc2b99e..d97aaebd 100644
--- a/src/wispr.c
+++ b/src/wispr.c
@@ -713,23 +713,23 @@ int __connman_wispr_start(struct connman_service *service,
else
return -EINVAL;
- if (wp_context == NULL) {
- wp_context = g_try_new0(struct connman_wispr_portal_context, 1);
- if (wp_context == NULL)
- return -ENOMEM;
+ /* If there is already an existing context, we wipe it */
+ if (wp_context != NULL)
+ free_connman_wispr_portal_context(wp_context);
- wp_context->service = service;
- wp_context->type = type;
+ wp_context = g_try_new0(struct connman_wispr_portal_context, 1);
+ if (wp_context == NULL)
+ return -ENOMEM;
- if (type == CONNMAN_IPCONFIG_TYPE_IPV4)
- wispr_portal->ipv4_context = wp_context;
- else
- wispr_portal->ipv6_context = wp_context;
+ wp_context->service = service;
+ wp_context->type = type;
- return wispr_portal_detect(wp_context);
- }
+ if (type == CONNMAN_IPCONFIG_TYPE_IPV4)
+ wispr_portal->ipv4_context = wp_context;
+ else
+ wispr_portal->ipv6_context = wp_context;
- return 0;
+ return wispr_portal_detect(wp_context);
}
void __connman_wispr_stop(struct connman_service *service)