summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/network.h3
-rw-r--r--plugins/bluetooth.c3
-rw-r--r--plugins/ethernet.c3
-rw-r--r--plugins/ofono.c4
-rw-r--r--plugins/wifi.c8
-rw-r--r--src/device.c5
-rw-r--r--src/network.c19
-rw-r--r--src/service.c7
8 files changed, 11 insertions, 41 deletions
diff --git a/include/network.h b/include/network.h
index e9bbdb3f..3db5e9b3 100644
--- a/include/network.h
+++ b/include/network.h
@@ -138,9 +138,6 @@ void connman_network_set_data(struct connman_network *network, void *data);
void connman_network_update(struct connman_network *network);
-int connman_network_register(struct connman_network *network);
-void connman_network_unregister(struct connman_network *network);
-
struct connman_network_driver {
const char *name;
enum connman_network_type type;
diff --git a/plugins/bluetooth.c b/plugins/bluetooth.c
index d112f876..ccc5e9bb 100644
--- a/plugins/bluetooth.c
+++ b/plugins/bluetooth.c
@@ -215,7 +215,6 @@ done:
dbus_pending_call_unref(call);
- connman_network_unregister(network);
connman_network_unref(network);
}
@@ -439,8 +438,6 @@ static void network_properties_reply(DBusPendingCall *call, void *user_data)
if (network == NULL)
goto done;
- connman_network_register(network);
-
connman_network_set_string(network, "Path", path);
connman_network_set_name(network, name);
diff --git a/plugins/ethernet.c b/plugins/ethernet.c
index 4829a33b..2ccd4989 100644
--- a/plugins/ethernet.c
+++ b/plugins/ethernet.c
@@ -92,15 +92,12 @@ static void add_network(struct connman_device *device)
if (network == NULL)
return;
- connman_network_register(network);
-
index = connman_device_get_index(device);
connman_network_set_index(network, index);
connman_network_set_name(network, "Wired");
if (connman_device_add_network(device, network) < 0) {
- connman_network_unregister(network);
connman_network_unref(network);
return;
}
diff --git a/plugins/ofono.c b/plugins/ofono.c
index 5a608823..9cc48c60 100644
--- a/plugins/ofono.c
+++ b/plugins/ofono.c
@@ -365,7 +365,6 @@ static void remove_network(gpointer data)
{
struct network_info *info = data;
- connman_network_unregister(info->network);
connman_network_unref(info->network);
g_free(info);
@@ -833,11 +832,8 @@ static int add_network(struct connman_device *device,
if (network == NULL)
return -ENOMEM;
- connman_network_register(network);
-
info = g_try_new0(struct network_info, 1);
if (info == NULL) {
- connman_network_unregister(network);
connman_network_unref(network);
return -ENOMEM;
}
diff --git a/plugins/wifi.c b/plugins/wifi.c
index f4e51b24..8a7da099 100644
--- a/plugins/wifi.c
+++ b/plugins/wifi.c
@@ -793,8 +793,6 @@ static void network_added(GSupplicantNetwork *supplicant_network)
if (network == NULL)
return;
- connman_network_register(network);
-
connman_network_set_index(network, wifi->index);
if (connman_device_add_network(wifi->device, network) < 0) {
@@ -835,10 +833,12 @@ static void network_removed(GSupplicantNetwork *network)
if (wifi != NULL) {
connman_network = connman_device_get_network(wifi->device, identifier);
- if (connman_network != NULL)
- connman_network_unregister(connman_network);
connman_device_remove_network(wifi->device, identifier);
+
+ if (connman_network != NULL)
+ connman_network_unref(connman_network);
+
}
}
diff --git a/src/device.c b/src/device.c
index 601f727c..7d02c332 100644
--- a/src/device.c
+++ b/src/device.c
@@ -418,7 +418,7 @@ void connman_device_driver_unregister(struct connman_device_driver *driver)
remove_driver(driver);
}
-static void unregister_network(gpointer data)
+static void free_network(gpointer data)
{
struct connman_network *network = data;
@@ -426,7 +426,6 @@ static void unregister_network(gpointer data)
__connman_network_set_device(network, NULL);
- connman_network_unregister(network);
connman_network_unref(network);
}
@@ -511,7 +510,7 @@ struct connman_device *connman_device_create(const char *node,
}
device->networks = g_hash_table_new_full(g_str_hash, g_str_equal,
- g_free, unregister_network);
+ g_free, free_network);
device_list = g_slist_append(device_list, device);
diff --git a/src/network.c b/src/network.c
index 06aec05b..220164a3 100644
--- a/src/network.c
+++ b/src/network.c
@@ -242,21 +242,6 @@ static void probe_driver(struct connman_network_driver *driver)
}
}
-int connman_network_register(struct connman_network *network)
-{
- network_list = g_slist_append(network_list, network);
-
- return network_probe(network);
-}
-
-
-void connman_network_unregister(struct connman_network *network)
-{
- network_list = g_slist_remove(network_list, network);
-
- network_remove(network);
-}
-
static void remove_driver(struct connman_network_driver *driver)
{
GSList *list;
@@ -391,6 +376,8 @@ struct connman_network *connman_network_create(const char *identifier,
network->type = type;
network->identifier = ident;
+ network_list = g_slist_append(network_list, network);
+
return network;
}
@@ -424,6 +411,8 @@ void connman_network_unref(struct connman_network *network)
if (g_atomic_int_dec_and_test(&network->refcount) == FALSE)
return;
+ network_list = g_slist_remove(network_list, network);
+
network_destruct(network);
}
diff --git a/src/service.c b/src/service.c
index b2516cd4..d442c167 100644
--- a/src/service.c
+++ b/src/service.c
@@ -2962,8 +2962,7 @@ static void service_free(gpointer user_data)
if (service->network != NULL) {
if (service->network_created == TRUE)
- connman_network_unregister(service->network);
- connman_network_unref(service->network);
+ connman_network_unref(service->network);
}
if (service->provider != NULL)
@@ -4075,8 +4074,6 @@ static struct connman_network *create_hidden_wifi(struct connman_device *device,
if (network == NULL)
return NULL;
- connman_network_register(network);
-
connman_network_set_blob(network, "WiFi.SSID",
(unsigned char *) ssid, ssid_len);
@@ -4085,7 +4082,6 @@ static struct connman_network *create_hidden_wifi(struct connman_device *device,
name = g_try_malloc0(ssid_len + 1);
if (name == NULL) {
- connman_network_unregister(network);
connman_network_unref(network);
return NULL;
}
@@ -4105,7 +4101,6 @@ static struct connman_network *create_hidden_wifi(struct connman_device *device,
connman_network_set_index(network, index);
if (connman_device_add_network(device, network) < 0) {
- connman_network_unregister(network);
connman_network_unref(network);
return NULL;
}