summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrik Flykt <patrik.flykt@linux.intel.com>2011-08-17 12:47:05 +0300
committerSamuel Ortiz <sameo@linux.intel.com>2011-08-17 12:05:23 +0200
commit025e5810dd96f6b54d7e392e6dce790d6dd42236 (patch)
treeb1a85c6672fc3ee49b91ef5282d92ff325b03a4f
parent064b6a4f86c465bcfdb88b7a9446355462d78cfd (diff)
downloadconnman-025e5810dd96f6b54d7e392e6dce790d6dd42236.tar.gz
connman-025e5810dd96f6b54d7e392e6dce790d6dd42236.tar.bz2
connman-025e5810dd96f6b54d7e392e6dce790d6dd42236.zip
service: Properly disconnect network or provider on connect failure
Correctly check whether a service has a network or a VPN provider associated with it if the service fails already in __connman_service_connect().
-rw-r--r--src/service.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/service.c b/src/service.c
index f5312b55..5fb11c04 100644
--- a/src/service.c
+++ b/src/service.c
@@ -4017,7 +4017,11 @@ int __connman_service_connect(struct connman_service *service)
CONNMAN_SERVICE_STATE_FAILURE,
CONNMAN_IPCONFIG_TYPE_IPV6);
- __connman_network_disconnect(service->network);
+ if (service->network != NULL)
+ __connman_network_disconnect(service->network);
+ else if (service->type == CONNMAN_SERVICE_TYPE_VPN &&
+ service->provider != NULL)
+ __connman_provider_disconnect(service->provider);
if (service->userconnect == TRUE) {
if (err == -ENOKEY) {