summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMohamed Abbas <mabbas@linux.intel.com>2010-12-22 11:58:02 -0800
committerSamuel Ortiz <sameo@linux.intel.com>2010-12-23 12:45:27 +0100
commitbe65ac7ada64530b5d9049bf23a89dfbd644ebd1 (patch)
tree05b2e3a1d52f38c79bd3e7b6eb8bf4fbe4490403
parent43e6e141ee352e77fdb894b918f280024785f3df (diff)
downloadconnman-be65ac7ada64530b5d9049bf23a89dfbd644ebd1.tar.gz
connman-be65ac7ada64530b5d9049bf23a89dfbd644ebd1.tar.bz2
connman-be65ac7ada64530b5d9049bf23a89dfbd644ebd1.zip
service: Avoid autoconnect from scan
If we are scanning then don't try to run autoconnect while we are adding network from scan, at the end of scan auto connect will be called.
-rw-r--r--src/connman.h2
-rw-r--r--src/device.c5
-rw-r--r--src/service.c8
3 files changed, 13 insertions, 2 deletions
diff --git a/src/connman.h b/src/connman.h
index 7c926fe2..fb269995 100644
--- a/src/connman.h
+++ b/src/connman.h
@@ -352,6 +352,8 @@ int __connman_device_disable(struct connman_device *device);
int __connman_device_disable_persistent(struct connman_device *device);
int __connman_device_disconnect(struct connman_device *device);
+connman_bool_t __connman_device_scanning(struct connman_device *device);
+
connman_bool_t __connman_device_has_driver(struct connman_device *device);
void __connman_device_set_reconnect(struct connman_device *device,
diff --git a/src/device.c b/src/device.c
index 957be7c1..c71529ef 100644
--- a/src/device.c
+++ b/src/device.c
@@ -815,6 +815,11 @@ void __connman_device_cleanup_networks(struct connman_device *device)
remove_unavailable_network, NULL);
}
+connman_bool_t __connman_device_scanning(struct connman_device *device)
+{
+ return device->scanning;
+}
+
/**
* connman_device_set_scanning:
* @device: device structure
diff --git a/src/service.c b/src/service.c
index 6ca80cd2..c7aed258 100644
--- a/src/service.c
+++ b/src/service.c
@@ -4125,6 +4125,7 @@ static void update_from_network(struct connman_service *service,
struct connman_service * __connman_service_create_from_network(struct connman_network *network)
{
struct connman_service *service;
+ struct connman_device *device;
const char *ident, *group;
char *name;
int index;
@@ -4185,8 +4186,11 @@ struct connman_service * __connman_service_create_from_network(struct connman_ne
service_register(service);
- if (service->favorite == TRUE)
- __connman_service_auto_connect();
+ if (service->favorite == TRUE) {
+ device = connman_network_get_device(service->network);
+ if (device && __connman_device_scanning(device) == FALSE)
+ __connman_service_auto_connect();
+ }
return service;
}