Hi,

On Sun, 2015-04-05 at 14:22 +0300, Slava Monich wrote:
> Otherwise the service may remain associated with a dead network.
> 
> In addition to that, update_from_network() now checks that session
> is associated with the correct network. Without this check, association
> with a dead network in the connecting state was unrecoverable.
> ---
>  src/service.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/src/service.c b/src/service.c
> index 7538bdd..6d3414d 100644
> --- a/src/service.c
> +++ b/src/service.c
> @@ -6616,6 +6616,11 @@ static void update_from_network(struct connman_service 
> *service,
>       if (is_connected(service))
>               return;
>  
> +     if (service->network && service->network != network) {
> +             connman_network_unref(service->network);
> +             service->network = NULL;
> +     }
> +
>       if (is_connecting(service))
>               return;

A service corresponding to a network is looked up in
__connman_service_create_from_network() using the network ident (not the
pointer itself). Thus the service and the network belong to each other.
The network plugins (must) ensure that network idents are unique.

It seems Jolla's other patches are a source of confusion here, last time
I looked services were created without valid network structures to back
them up. Please at some point fix such things and move UI layer things
to the UI, not ConnMan.
 
> @@ -6863,6 +6868,11 @@ void __connman_service_remove_from_network(struct 
> connman_network *network)
>       __connman_connection_gateway_remove(service,
>                                       CONNMAN_IPCONFIG_TYPE_ALL);
>  
> +     if (service->network) {
> +             connman_network_unref(service->network);
> +             service->network = NULL;
> +     }
> +
>       connman_service_unref(service);
>  }
>  

No network, no service. The network unref is done with
g_hash_table_remove() in connman_service_unref().

Again Jolla's additional patches break this assumption as you may have
one more reference for the service not to loose a network-less one from
the list, right?


Cheers,

        Patrik

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

Reply via email to