diff options
author | Ondrej Holy <oholy@redhat.com> | 2020-12-18 15:42:23 +0100 |
---|---|---|
committer | Ondrej Holy <oholy@redhat.com> | 2020-12-18 15:32:25 +0000 |
commit | 7e8c3091b5f3f48fc72787a54ff20569c2903f36 (patch) | |
tree | 1e1c6ab15ff66dde77d766c60bfbb534ba1614f1 /client | |
parent | dad5415fe49a5990d39d8390e9b01af3f77cef9a (diff) | |
download | gvfs-7e8c3091b5f3f48fc72787a54ff20569c2903f36.tar.gz |
client: Skip session bus fallback if operation was cancelled
Recently added warnings when peer-to-peer connection fails (commit 60ca0cea)
makes visible old bug that the session bus fallback is tried regardless of
the fact that the operation was cancelled. Let's stop the operation
immediately when G_IO_ERROR_CANCELLED is returned and don't print the
warnings in this case.
Diffstat (limited to 'client')
-rw-r--r-- | client/gdaemonfile.c | 10 | ||||
-rw-r--r-- | client/gdaemonfilemonitor.c | 2 | ||||
-rw-r--r-- | client/gdaemonmount.c | 8 | ||||
-rw-r--r-- | client/gvfsiconloadable.c | 10 |
4 files changed, 27 insertions, 3 deletions
diff --git a/client/gdaemonfile.c b/client/gdaemonfile.c index 2ea6cd7c..2d09f6af 100644 --- a/client/gdaemonfile.c +++ b/client/gdaemonfile.c @@ -438,7 +438,7 @@ create_proxy_for_file2 (GFile *file1, } connection = _g_dbus_connection_get_sync (mount_info1->dbus_id, cancellable, &local_error); - if (connection == NULL) + if (connection == NULL && !g_error_matches (local_error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) { g_dbus_error_strip_remote_error (local_error); g_warning ("The peer-to-peer connection failed: %s. Falling back to the " @@ -625,6 +625,14 @@ async_got_connection_cb (GDBusConnection *connection, if (connection == NULL) { g_dbus_error_strip_remote_error (io_error); + + if (g_error_matches (io_error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) + { + g_task_return_error (data->task, g_error_copy (io_error)); + async_proxy_create_free (data); + return; + } + g_warning ("The peer-to-peer connection failed: %s. Falling back to the " "session bus. Your application is probably missing " "--filesystem=xdg-run/gvfsd privileges.", io_error->message); diff --git a/client/gdaemonfilemonitor.c b/client/gdaemonfilemonitor.c index 99e356af..b166552d 100644 --- a/client/gdaemonfilemonitor.c +++ b/client/gdaemonfilemonitor.c @@ -178,7 +178,7 @@ g_daemon_file_monitor_new (const char *remote_id, daemon_monitor->remote_obj_path = g_strdup (remote_obj_path); connection = _g_dbus_connection_get_sync (daemon_monitor->remote_id, NULL, &error); - if (connection == NULL) + if (connection == NULL && !g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) { g_dbus_error_strip_remote_error (error); g_warning ("The peer-to-peer connection failed: %s. Falling back to the " diff --git a/client/gdaemonmount.c b/client/gdaemonmount.c index a3cb2578..ca01c005 100644 --- a/client/gdaemonmount.c +++ b/client/gdaemonmount.c @@ -316,6 +316,14 @@ async_got_connection_cb (GDBusConnection *connection, if (connection == NULL) { g_dbus_error_strip_remote_error (io_error); + + if (g_error_matches (io_error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) + { + g_task_return_error (task, g_error_copy (io_error)); + g_object_unref (task); + return; + } + g_warning ("The peer-to-peer connection failed: %s. Falling back to the " "session bus. Your application is probably missing " "--filesystem=xdg-run/gvfsd privileges.", io_error->message); diff --git a/client/gvfsiconloadable.c b/client/gvfsiconloadable.c index f1e6cd08..a394769d 100644 --- a/client/gvfsiconloadable.c +++ b/client/gvfsiconloadable.c @@ -58,7 +58,7 @@ create_proxy_for_icon (GVfsIcon *vfs_icon, goto out; connection = _g_dbus_connection_get_sync (mount_info->dbus_id, cancellable, &local_error); - if (connection == NULL) + if (connection == NULL && !g_error_matches (local_error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) { g_dbus_error_strip_remote_error (local_error); g_warning ("The peer-to-peer connection failed: %s. Falling back to the " @@ -254,6 +254,14 @@ async_got_connection_cb (GDBusConnection *connection, if (connection == NULL) { g_dbus_error_strip_remote_error (io_error); + + if (g_error_matches (io_error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) + { + g_task_return_error (data->task, g_error_copy (io_error)); + async_path_call_free (data); + return; + } + g_warning ("The peer-to-peer connection failed: %s. Falling back to the " "session bus. Your application is probably missing " "--filesystem=xdg-run/gvfsd privileges.", io_error->message); |