summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrik Flykt <patrik.flykt@linux.intel.com>2012-10-17 10:34:43 (GMT)
committerPatrik Flykt <patrik.flykt@linux.intel.com>2012-10-18 10:27:16 (GMT)
commitab0c25458460cb2bb5f1e5b2549a8b9e81a59660 (patch)
treeb813851e9faad98b9f5a2f2b08b487a89f2fe563
parent288e8833a4c685a0a039770f08ed13bb64b20360 (diff)
downloadconnman-ab0c25458460cb2bb5f1e5b2549a8b9e81a59660.zip
connman-ab0c25458460cb2bb5f1e5b2549a8b9e81a59660.tar.gz
connman-ab0c25458460cb2bb5f1e5b2549a8b9e81a59660.tar.bz2
service: Prefer user connected services with SingleConnectedTechnology
Don't override user connected services with the ones selected by the preferred technology list when SingleConnectedTechnology is enabled. Do this by checking each connected service sorted in the beginning of the service list for the userconnect flag.
-rw-r--r--src/service.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/service.c b/src/service.c
index a027b3e..7381af3 100644
--- a/src/service.c
+++ b/src/service.c
@@ -3377,6 +3377,26 @@ static GSequence* preferred_tech_list_get(GSequence *list)
if (tech_array == NULL)
return NULL;
+ if (connman_setting_get_bool("SingleConnectedTechnology") == TRUE) {
+ GSequenceIter *iter = g_sequence_get_begin_iter(service_list);
+ while (g_sequence_iter_is_end(iter) == FALSE) {
+ struct connman_service *service;
+
+ service = g_sequence_get(iter);
+
+ if (is_connected(service) == FALSE)
+ break;
+
+ if (service->userconnect == TRUE) {
+ DBG("service %p name %s is user connected",
+ service, service->name);
+ return NULL;
+ }
+
+ iter = g_sequence_iter_next(iter);
+ }
+ }
+
tech_data.preferred_list = g_sequence_new(NULL);
for (i = 0; tech_array[i] != 0; i += 1) {