There is a small time interval from the time from start a connect
to a network and receiving AUTH and ASSOC signal from supplicant
that cause is_connecting to report FALSE when we are in
the process of connecting.
Also in __connman_service_auto_connect function we not want
to start connecting if another service is connected or in process,
since service_list does not sort connecting services we can
start connection while another service is already connecting.
---
src/service.c | 31 +++++++++++++++++++++++++------
1 files changed, 25 insertions(+), 6 deletions(-)
diff --git a/src/service.c b/src/service.c
index fcb1141..9e0f45c 100644
--- a/src/service.c
+++ b/src/service.c
@@ -67,6 +67,7 @@ struct connman_service {
connman_bool_t ignore;
connman_bool_t autoconnect;
connman_bool_t userconnect;
+ connman_bool_t request_connect;
GTimeVal modified;
unsigned int order;
char *name;
@@ -2138,6 +2139,7 @@ static connman_bool_t is_ignore(struct connman_service
*service)
void __connman_service_auto_connect(void)
{
struct connman_service *service = NULL;
+ struct connman_service *select_service = NULL;
GSequenceIter *iter;
DBG("");
@@ -2147,30 +2149,38 @@ void __connman_service_auto_connect(void)
while (g_sequence_iter_is_end(iter) == FALSE) {
service = g_sequence_get(iter);
+ if (service->request_connect == TRUE)
+ return;
+
if (service->pending != NULL)
return;
if (is_connecting(service) == TRUE)
return;
- if (service->favorite == FALSE)
+ if (service->favorite == FALSE) {
+ if (select_service != NULL)
+ break;
return;
+ }
if (is_connected(service) == TRUE)
return;
if (is_ignore(service) == FALSE &&
- service->state == CONNMAN_SERVICE_STATE_IDLE)
- break;
+ service->state == CONNMAN_SERVICE_STATE_IDLE) {
+ if (select_service == NULL)
+ select_service = service;
+ }
service = NULL;
iter = g_sequence_iter_next(iter);
}
- if (service != NULL) {
- service->userconnect = FALSE;
- __connman_service_connect(service);
+ if (select_service != NULL) {
+ select_service->userconnect = FALSE;
+ __connman_service_connect(select_service);
}
}
@@ -2186,6 +2196,8 @@ static void reply_pending(struct connman_service
*service, int error)
{
remove_timeout(service);
+ service->request_connect = FALSE;
+
if (service->pending != NULL) {
if (error > 0) {
DBusMessage *reply;
@@ -2211,6 +2223,8 @@ static gboolean connect_timeout(gpointer user_data)
DBG("service %p", service);
+ service->request_connect = FALSE;
+
service->timeout = 0;
if (service->network != NULL) {
@@ -3023,6 +3037,8 @@ int __connman_service_indicate_state(struct
connman_service *service,
service->state = state;
state_changed(service);
+ service->request_connect = FALSE;
+
if (state == CONNMAN_SERVICE_STATE_ONLINE) {
if (service->login_required == TRUE) {
service->login_required = FALSE;
@@ -3312,6 +3328,7 @@ int __connman_service_connect(struct connman_service
*service)
service->timeout = g_timeout_add_seconds(CONNECT_TIMEOUT,
connect_timeout, service);
+ service->request_connect = TRUE;
return -EINPROGRESS;
}
@@ -3334,6 +3351,8 @@ int __connman_service_disconnect(struct connman_service
*service)
else
return -EOPNOTSUPP;
+ service->request_connect = FALSE;
+
__connman_ipconfig_set_proxy_autoconfig(service->ipconfig, NULL);
__connman_ipconfig_clear_address(service->ipconfig);
--
1.7.2.3
_______________________________________________
connman mailing list
[email protected]
http://lists.connman.net/listinfo/connman