From 47cd3d91cb069be8cbd6b1e72d6b33cab01e3b13 Mon Sep 17 00:00:00 2001 From: Samuel Ortiz Date: Fri, 25 Jun 2010 14:56:05 +0200 Subject: [PATCH] Create service ipconfig only when it's NULL If a service already has an allocated ipconfig layer but the corresponding network index is negative, the only thing left to do is to set the ipconfig index properly. The oFono plugin toggles the network index between connection while the service ipconfig layer stays alive. --- src/network.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/network.c b/src/network.c index a241d15..c36298e 100644 --- a/src/network.c +++ b/src/network.c @@ -447,12 +447,15 @@ const char *connman_network_get_path(struct connman_network *network) void connman_network_set_index(struct connman_network *network, int index) { struct connman_service *service; + struct connman_ipconfig *ipconfig; service = __connman_service_lookup_from_network(network); if (service == NULL) goto done; - if (network->element.index < 0) + ipconfig = __connman_service_get_ipconfig(service); + + if (network->element.index < 0 && ipconfig == NULL) /* * This is needed for plugins that havent set their ipconfig * layer yet, due to not being able to get a network index @@ -460,10 +463,7 @@ void connman_network_set_index(struct connman_network *network, int index) */ __connman_service_create_ipconfig(service, index); else { - struct connman_ipconfig *ipconfig; - /* If index changed, the index of ipconfig must be reset. */ - ipconfig = __connman_service_get_ipconfig(service); if (ipconfig == NULL) goto done; -- 2.7.4