From 6e45cd900c6e12e0bf10ec229cc9b190c074fabe Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Mon, 28 Jan 2019 11:58:18 +0100 Subject: [PATCH] libnm/device-p2p-wifi: drop API that still needs consideration Having synchronous API is wrong, or at least questionable. Granted, libnm isn't currently very good about the exact order of things to happen. However synchronous API by design delays events while waiting for the response and hence messes up the ordering. Maybe synchronous API should not be added to libnm. Or at least, if we have synchronous API, we certainly need an asynchrnous variant as well (which is still missing). As synchronous API is not preferred, it should also be named nm_some_thing_sync(), accompanied by nm_some_thing() and nm_some_thing_finish(). The name for the synchronous method should be the odd one and we shouldn't have an nm_some_thing_async(). Yes, libnm is not consistend about that. I am going to drop this API for the moment. --- libnm/libnm.ver | 2 -- libnm/nm-device-p2p-wifi.c | 70 -------------------------------------- libnm/nm-device-p2p-wifi.h | 10 ------ 3 files changed, 82 deletions(-) diff --git a/libnm/libnm.ver b/libnm/libnm.ver index 0267c140a0..21dfb8ee1e 100644 --- a/libnm/libnm.ver +++ b/libnm/libnm.ver @@ -1454,8 +1454,6 @@ global: nm_device_p2p_wifi_get_hw_address; nm_device_p2p_wifi_get_peers; nm_device_p2p_wifi_get_type; - nm_device_p2p_wifi_start_find; - nm_device_p2p_wifi_stop_find; nm_p2p_peer_connection_valid; nm_p2p_peer_filter_connections; nm_p2p_peer_get_flags; diff --git a/libnm/nm-device-p2p-wifi.c b/libnm/nm-device-p2p-wifi.c index fad25b58b1..c9be88ff1a 100644 --- a/libnm/nm-device-p2p-wifi.c +++ b/libnm/nm-device-p2p-wifi.c @@ -237,76 +237,6 @@ nm_device_p2p_wifi_get_wfdies_as_variant (const NMDeviceP2PWifi *self) return g_variant_new_array (G_VARIANT_TYPE_BYTE, NULL, 0); } -/** - * nm_device_p2p_wifi_start_find: - * @device: a #NMDeviceP2PWifi - * @cancellable: a #GCancellable, or %NULL - * @error: location for a #GError, or %NULL - * - * Request NM to search for P2P peers on @device. Note that the function - * returns immediately after requesting the find, and it may take some time - * after that for peers to be found. - * - * The find operation will run for 30s by default. You can stop it earlier - * using nm_device_p2p_wifi_stop_find(). - * - * Returns: %TRUE on success, %FALSE on error, in which case @error will be - * set. - * - * Since: 1.16 - **/ -gboolean -nm_device_p2p_wifi_start_find (NMDeviceP2PWifi *device, - GCancellable *cancellable, - GError **error) -{ - NMDeviceP2PWifiPrivate *priv = NM_DEVICE_P2P_WIFI_GET_PRIVATE (device); - GVariant *options = g_variant_new_array (G_VARIANT_TYPE ("{sv}"), NULL, 0); - gboolean ret; - - g_return_val_if_fail (NM_IS_DEVICE_P2P_WIFI (device), FALSE); - - ret = nmdbus_device_p2p_wifi_call_start_find_sync (priv->proxy, - options, - cancellable, error); - - if (error && *error) - g_dbus_error_strip_remote_error (*error); - - return ret; -} - -/** - * nm_device_p2p_wifi_stop_find: - * @device: a #NMDeviceP2PWifi - * @cancellable: a #GCancellable, or %NULL - * @error: location for a #GError, or %NULL - * - * Request NM to stop searching for P2P peers on @device. - * - * Returns: %TRUE on success, %FALSE on error, in which case @error will be - * set. - * - * Since: 1.16 - **/ -gboolean -nm_device_p2p_wifi_stop_find (NMDeviceP2PWifi *device, - GCancellable *cancellable, - GError **error) -{ - NMDeviceP2PWifiPrivate *priv = NM_DEVICE_P2P_WIFI_GET_PRIVATE (device); - gboolean ret; - - g_return_val_if_fail (NM_IS_DEVICE_P2P_WIFI (device), FALSE); - - ret = nmdbus_device_p2p_wifi_call_stop_find_sync (priv->proxy, - cancellable, error); - if (error && *error) - g_dbus_error_strip_remote_error (*error); - - return ret; -} - /*****************************************************************************/ static void diff --git a/libnm/nm-device-p2p-wifi.h b/libnm/nm-device-p2p-wifi.h index e9bfb26a19..bd5841fde2 100644 --- a/libnm/nm-device-p2p-wifi.h +++ b/libnm/nm-device-p2p-wifi.h @@ -58,16 +58,6 @@ NMP2PPeer * nm_device_p2p_wifi_get_peer_by_path (NMDeviceP2PWifi *d NM_AVAILABLE_IN_1_16 const GPtrArray * nm_device_p2p_wifi_get_peers (NMDeviceP2PWifi *device); -NM_AVAILABLE_IN_1_16 -gboolean nm_device_p2p_wifi_start_find (NMDeviceP2PWifi *device, - GCancellable *cancellable, - GError **error); - -NM_AVAILABLE_IN_1_16 -gboolean nm_device_p2p_wifi_stop_find (NMDeviceP2PWifi *device, - GCancellable *cancellable, - GError **error); - G_END_DECLS #endif /* __NM_DEVICE_P2P_WIFI_H__ */