Hi Samuel,

ext Samuel Ortiz wrote:
> Hi Jukka,
> 
> On Tue, Feb 08, 2011 at 12:30:09PM +0200, Jukka Rissanen wrote:
>> ---
>>  src/service.c |   17 +++++++++++++----
>>  1 files changed, 13 insertions(+), 4 deletions(-)
>> 
>> diff --git a/src/service.c b/src/service.c index c27431c..89f7b4d
>> 100644 --- a/src/service.c
>> +++ b/src/service.c
>> @@ -3245,6 +3245,7 @@ int __connman_service_indicate_state(struct
>>      connman_service *service, enum connman_service_state service_state,
>>              state = CONNMAN_SERVICE_STATE_IDLE;
>>      GSequenceIter *iter;
>> +    connman_bool_t disconnected = FALSE;
>> 
>>      if (service == NULL)
>>              return -EINVAL;
>> @@ -3384,11 +3385,18 @@ int __connman_service_indicate_state(struct
>> connman_service *service,
>> 
>>              default_changed();
>>      } else if (state == CONNMAN_SERVICE_STATE_DISCONNECT) {
>> -            __connman_location_finish(service);
>> 
>> -            default_changed();
>> +            if (service->state_ipv4 == CONNMAN_SERVICE_STATE_DISCONNECT ||
>> +                    service->state_ipv6 == +                                
>>         CONNMAN_SERVICE_STATE_DISCONNECT) {
> Don't you want a && here ?

No, the || was there on purpose. The reason is that the state variable is 
combined from state_ipv4 and state_ipv6 which means that state is set to 
DISCONNECT if state_ipv4 is IDLE and state_ipv6 is DISCONNECT. So it is 
possible that only one of state_ipv4 or state_ipv6 is DISCONNECT and not the 
both in the same time.


> Also, could you please rework this patch so that we first have:
> 
> disconnect = service->state_ipv4 == CONNMAN_SERVICE_STATE_DISCONNECT
>               && service->state_ipv6 == CONNMAN_SERVICE_STATE_DISCONNECT;
> 
> And then we check for disconnect ?

This would not work as only one of the state can cause the system to 
disconnect. The state combining is quite tricky and I spent many hours trying 
to get it right, hopefully everything works ok.


Jukka

_______________________________________________
connman mailing list
connman@connman.net
http://lists.connman.net/listinfo/connman

Reply via email to