libnm: undeprecate nm_remote_connection_get_secrets()
Various synchronous methods (D-Bus calls) in libnm's NMClient API were deprecated. The problem is that NMClient contains a cache of D-Bus objects, and it gets updated by asynchronous events (D-Bus signals). Those events get only processed when iterating the GMainContext, but they are ordered. When we perform a pseudo blocking D-Bus call with g_dbus_connection_call_sync(), then GDBus creates a temporary GMainContext, sends the request and iterates the internal context blocking for the response. That is, this reply is not synchrounized with the events that update the NMClient cache. That is a problem for methods like nm_remote_connection_delete(), because you call blocking delete, but afterwards the object is still in the NMClient cache. That's why most blocking methods are deprecated. While such blocking calls are therefore problematic, they can still be very convenient to call from a simple script, a test tool or the python REPL. See "examples/python/gi/nm-wg-set" which calls nm_remote_connection_get_secrets(), and it would be (unnecessarily) cumbersome to do the correct thing or using async API. In particular, nm_remote_connection_get_secrets() doesn't retrieve an object that is in the NMClient cache in the first place. Sure, the result is out of order with the cache, but it's not obviously related and in most cases it wouldn't matter to the user. So undeprecate this function again. https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1345
This commit is contained in:
@@ -443,7 +443,11 @@ nm_remote_connection_delete_finish(NMRemoteConnection *connection,
|
||||
* Returns: (transfer full): a #GVariant of type %NM_VARIANT_TYPE_CONNECTION containing
|
||||
* @connection's secrets, or %NULL on error.
|
||||
*
|
||||
* Deprecated: 1.22: Use nm_remote_connection_get_secrets_async() or GDBusConnection.
|
||||
* Warning: NMClient contains a cache of objects on D-Bus. This cache gets updated
|
||||
* with D-Bus signals when iterating the GMainContext. This function performs a
|
||||
* (pseudo) blocking D-Bus call. Aside blocking, the result will not be in sync
|
||||
* and not be ordered with the content of the NMClient cache.
|
||||
* This function used to be deprecated between 1.22 and 1.38 releases.
|
||||
**/
|
||||
GVariant *
|
||||
nm_remote_connection_get_secrets(NMRemoteConnection *connection,
|
||||
|
@@ -96,7 +96,6 @@ gboolean nm_remote_connection_delete_finish(NMRemoteConnection *connection,
|
||||
GAsyncResult *result,
|
||||
GError **error);
|
||||
|
||||
_NM_DEPRECATED_SYNC_METHOD
|
||||
GVariant *nm_remote_connection_get_secrets(NMRemoteConnection *connection,
|
||||
const char *setting_name,
|
||||
GCancellable *cancellable,
|
||||
|
Reference in New Issue
Block a user