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

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

Reply via email to