while (g_hash_table_iter_next(&iter, &key, &value) == TRUE) {
struct connman_network *network = value;
+ if (__connman_network_get_connecting(network) == TRUE) {
+ /*
+ * Skip network in the process of connecting.
+ * This is a workaround for WiFi networks serviced
+ * by the supplicant plugin that hold a reference
+ * to the network. If we disconnect the network
+ * here then the referenced object will not be
+ * registered and usage (like launching DHCP client)
+ * will fail. There is nothing to be gained by
+ * removing the network here anyway.
+ */
+ connman_warn("Skipping disconnect of %s",
+ connman_network_get_identifier(network));
+ continue;
+ }
+
__connman_network_disconnect(network);
}