+ }
+
+ return -EINPROGRESS;
+}
+
+static void disconnect_callback(int result, GSupplicantInterface *interface,
+ void *user_data)
+{
+ struct wifi_data *wifi = user_data;
+
+ if (wifi->network != NULL) {
+ /*
+ * if result < 0 supplican return an error because
+ * the network is not current.
+ * we wont receive G_SUPPLICANT_STATE_DISCONNECTED since it
+ * failed, call connman_network_set_connected to report
+ * disconnect is completed.
+ */
+ if (result < 0)
+ connman_network_set_connected(wifi->network, FALSE);
+
+ connman_network_unref(wifi->network);
+ }
+
+ wifi->network = NULL;
+
+ wifi->disconnecting = FALSE;
+
+ if (wifi->pending_network != NULL) {
+ network_connect(wifi->pending_network);
+ connman_network_unref(wifi->pending_network);
+ wifi->pending_network = NULL;
+ }
+