From bd430d3a5c81c4c471c2846cc919da4ef5aa0f5d Mon Sep 17 00:00:00 2001 From: Martin Xu Date: Wed, 5 May 2010 23:26:59 +0800 Subject: [PATCH] Call __connman_notifier_connect() only when state is READY If we call it at READY or ONLINE state, The function will be called twice and connected times is set as two. And StateChanged signal "offline" will never be emitted. Commit 59a8daa3 ("ONLINE and LOGIN are also "connected" states.") added a check for also state CONNMAN_SERVICE_STATE_LOGIN in __connman_service_indicate_state(). But this meant that __connman_notifier_connect() was called twice for each service, first in READY state and then in LOGIN state. This broke refcounting in notifier.c and caused a bug that Manager interface would always clame to be in online state after a first successful connection even if all services were disconnected. --- src/service.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/service.c b/src/service.c index ff623e6..31d4004 100644 --- a/src/service.c +++ b/src/service.c @@ -1620,8 +1620,7 @@ int __connman_service_indicate_state(struct connman_service *service, __connman_service_auto_connect(); } - if (state == CONNMAN_SERVICE_STATE_READY || - state == CONNMAN_SERVICE_STATE_ONLINE) { + if (state == CONNMAN_SERVICE_STATE_READY) { set_reconnect_state(service, TRUE); __connman_service_set_favorite(service, TRUE); -- 2.7.4