RE: [PATCH] service: Change service state before changing manager state

2014-09-03 Thread Chengyi Zhao
Hi Patrik,

> 
> > 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.
> 
> What consistency are you after here? Is it the ordering between
> net.connman.Manager and net.connman.Service State properties? If yes, I

Yes, it is the ordering between net.connman.Manager and net.connman.Service 
State properties.

> believe that setting PreferredTechnologies will still send the Manager
> and Service states in the current order.

--- 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);
}
 }

Because 'apply_relevant_default_downgrade' has been indirectly called by
'service_update_preferred_order',if apply this patch, when setting 
PreferredTechnologies, net.connman.Service State properties will be changed 
before net.connman.Manager 
State property.

However, this patch is only a minor suggestion, you can ignore it.

Thanks,

Chengyi


  
___
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman

Re: [PATCH] service: Change service state before changing manager state

2014-09-02 Thread Patrik Flykt

Hi,

On Thu, 2014-08-28 at 15:44 +0800, Chengyi Zhao wrote:

> 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.

What consistency are you after here? Is it the ordering between
net.connman.Manager and net.connman.Service State properties? If yes, I
believe that setting PreferredTechnologies will still send the Manager
and Service states in the current order.

Cheers,

Patrik

___
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman


[PATCH] service: Change service state before changing manager state

2014-08-28 Thread Chengyi Zhao
From: Chengyi Zhao 

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
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman