Add function for cleaning out stale networks
authorMarcel Holtmann <marcel@holtmann.org>
Fri, 17 Jul 2009 11:11:14 +0000 (13:11 +0200)
committerMarcel Holtmann <marcel@holtmann.org>
Fri, 17 Jul 2009 11:11:14 +0000 (13:11 +0200)
src/connman.h
src/device.c

index 6dd57cc..0ac1c71 100644 (file)
@@ -206,6 +206,7 @@ void __connman_device_decrease_connections(struct connman_device *device);
 
 void __connman_device_set_network(struct connman_device *device,
                                        struct connman_network *network);
+void __connman_device_cleanup_networks(struct connman_device *device);
 
 int __connman_device_scan(struct connman_device *device);
 int __connman_device_connect(struct connman_device *device);
index 2bdc9cc..c05fada 100644 (file)
@@ -1453,6 +1453,12 @@ static gboolean remove_unavailable_network(gpointer key, gpointer value,
        return TRUE;
 }
 
+void __connman_device_cleanup_networks(struct connman_device *device)
+{
+       g_hash_table_foreach_remove(device->networks,
+                                       remove_unavailable_network, NULL);
+}
+
 /**
  * connman_device_set_scanning:
  * @device: device structure
@@ -1510,8 +1516,7 @@ int connman_device_set_scanning(struct connman_device *device,
                return 0;
        }
 
-       g_hash_table_foreach_remove(device->networks,
-                                       remove_unavailable_network, NULL);
+       __connman_device_cleanup_networks(device);
 
        if (device->connections > 0)
                return 0;