Don't trigger auto-connect when connection attempt is pending
authorMarcel Holtmann <marcel@holtmann.org>
Thu, 9 Jul 2009 05:39:58 +0000 (22:39 -0700)
committerMarcel Holtmann <marcel@holtmann.org>
Thu, 9 Jul 2009 05:39:58 +0000 (22:39 -0700)
src/service.c

index 5c4379b..47ba507 100644 (file)
@@ -435,6 +435,24 @@ static connman_bool_t is_connecting(struct connman_service *service)
        return FALSE;
 }
 
+static struct connman_service *find_pending_service(void)
+{
+       struct connman_service *service;
+       GSequenceIter *iter;
+
+       iter = g_sequence_get_begin_iter(service_list);
+
+       while (g_sequence_iter_is_end(iter) == FALSE) {
+               service = g_sequence_get(iter);
+               if (service->pending != NULL)
+                       return service;
+
+               iter = g_sequence_iter_next(iter);
+       }
+
+       return NULL;
+}
+
 static void __connman_service_auto_connect(void)
 {
        struct connman_service *service;
@@ -442,6 +460,10 @@ static void __connman_service_auto_connect(void)
 
        DBG("");
 
+       service = find_pending_service();
+       if (service != NULL)
+               return;
+
        iter = g_sequence_get_begin_iter(service_list);
        if (g_sequence_iter_is_end(iter) == TRUE)
                return;