summaryrefslogtreecommitdiff
path: root/src/connection.c
diff options
context:
space:
mode:
authorJukka Rissanen <jukka.rissanen@linux.intel.com>2012-01-18 16:46:36 +0200
committerSamuel Ortiz <sameo@linux.intel.com>2012-01-20 01:42:07 +0100
commit282188d62b9f81f1a46fd6b3341f1992f02b29a5 (patch)
tree29feb7eff8869f4f23b19b5cffa8dcc4c6474445 /src/connection.c
parentc925f1bff1846b1ed4d12ae02358bc6444ddfe06 (diff)
downloadconnman-282188d62b9f81f1a46fd6b3341f1992f02b29a5.tar.gz
connman-282188d62b9f81f1a46fd6b3341f1992f02b29a5.tar.bz2
connman-282188d62b9f81f1a46fd6b3341f1992f02b29a5.zip
connection: Only take service ref when saving service
The fix b68795352dd5a9ac41eab31c765ade0c88329a6e was only partly working. We must only take the ref when we are saving stuff to hash (no need to take ref if we are only modifying value in the hash). This patch reverts the commit b68795
Diffstat (limited to 'src/connection.c')
-rw-r--r--src/connection.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/src/connection.c b/src/connection.c
index 58adfeb6..2b18ef5c 100644
--- a/src/connection.c
+++ b/src/connection.c
@@ -227,9 +227,13 @@ static struct gateway_data *add_gateway(struct connman_service *service,
data->ipv4_gateway = old->ipv4_gateway;
old->ipv4_gateway = NULL;
}
+ } else {
+ /*
+ * Only take a ref if we are adding new stuff to hash.
+ */
+ connman_service_ref(service);
}
- connman_service_ref(service);
g_hash_table_replace(gateway_hash, service, data);
return data;
@@ -713,14 +717,6 @@ void __connman_connection_gateway_remove(struct connman_service *service,
err = disable_gateway(data, type);
/*
- * We may refcount service twice seperately for ipv4 and ipv6
- * then we need to unref accordingly.
- */
- if (do_ipv4 == do_ipv6 && data->ipv4_gateway != NULL &&
- data->ipv6_gateway != NULL)
- connman_service_unref(service);
-
- /*
* We remove the service from the hash only if all the gateway
* settings are to be removed.
*/