From: Chengyi Zhao <[email protected]>

The manager state is a global connection state of the system,
and it is a result of evaluating various notification states.

In order to ensure the consistency of data, ConnMan should
change the service state before changing the manager state,
wheter to change local states or emitting remote signals.
---
 src/service.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/service.c b/src/service.c
index f35f436..a178c5f 100644
--- a/src/service.c
+++ b/src/service.c
@@ -4109,8 +4109,8 @@ static void apply_relevant_default_downgrade(struct 
connman_service *service)
        if (def_service == service &&
                        def_service->state == CONNMAN_SERVICE_STATE_ONLINE) {
                def_service->state = CONNMAN_SERVICE_STATE_READY;
-               __connman_notifier_leave_online(def_service->type);
                state_changed(def_service);
+               __connman_notifier_leave_online(def_service->type);
        }
 }
 
@@ -5301,12 +5301,12 @@ static int service_indicate_state(struct 
connman_service *service)
                        return result;
        }
 
-       if (old_state == CONNMAN_SERVICE_STATE_ONLINE)
-               __connman_notifier_leave_online(service->type);
-
        service->state = new_state;
        state_changed(service);
 
+       if (old_state == CONNMAN_SERVICE_STATE_ONLINE)
+               __connman_notifier_leave_online(service->type);
+
        if (new_state == CONNMAN_SERVICE_STATE_IDLE &&
                        old_state != CONNMAN_SERVICE_STATE_DISCONNECT) {
 
-- 
1.8.1.2

_______________________________________________
connman mailing list
[email protected]
https://lists.connman.net/mailman/listinfo/connman

Reply via email to