[gvfs/gnome-3-18] client: Use sync methods instead of flushing dbus



commit 21d81f54bc7fd895d5700dcb8bada9cc42dfc586
Author: Ondrej Holy <oholy redhat com>
Date:   Wed Nov 23 18:03:05 2016 +0100

    client: Use sync methods instead of flushing dbus
    
    g_dbus_connection_flush_sync causes troubles in certain cases when
    using multiple threads. The problem occurs when there are ongoing
    gvfs_metadata_call_set_sync calls. It blocks threads e.g. when
    moving files over Nautilus. Nautilus freezes sometimes due to it.
    Use sync methods instead of flushing dbus. I don't see any significant
    slowdown when using sync methods instead of the flushing according
    to my testing. It fixes hangs in Nautilus and moving in Nautilus is
    almost instant again.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=757747

 client/gdaemonvfs.c |   32 +++++++++++---------------------
 1 files changed, 11 insertions(+), 21 deletions(-)
---
diff --git a/client/gdaemonvfs.c b/client/gdaemonvfs.c
index 8a91570..5993554 100644
--- a/client/gdaemonvfs.c
+++ b/client/gdaemonvfs.c
@@ -1361,16 +1361,11 @@ g_daemon_vfs_local_file_removed (GVfs       *vfs,
       if (proxy)
         {
           metatreefile = meta_tree_get_filename (tree);
-          /* we don't care about the result, let's queue the call and don't block */
-          gvfs_metadata_call_remove (proxy,
-                                     metatreefile,
-                                     tree_path,
-                                     NULL,
-                                     NULL, /* callback */
-                                     NULL);
-          /* flush the call with the expense of sending all queued messages on the connection */
-          g_dbus_connection_flush_sync (g_dbus_proxy_get_connection (G_DBUS_PROXY (proxy)),
-                                        NULL, NULL);
+          gvfs_metadata_call_remove_sync (proxy,
+                                          metatreefile,
+                                          tree_path,
+                                          NULL,
+                                          NULL);
         }
       
       meta_tree_unref (tree);
@@ -1408,17 +1403,12 @@ g_daemon_vfs_local_file_moved (GVfs       *vfs,
       if (proxy)
         {
           metatreefile = meta_tree_get_filename (tree1);
-          /* we don't care about the result, let's queue the call and don't block */
-          gvfs_metadata_call_move (proxy,
-                                   metatreefile,
-                                   tree_path1,
-                                   tree_path2,
-                                   NULL,
-                                   NULL, /* callback */
-                                   NULL);
-          /* flush the call with the expense of sending all queued messages on the connection */
-          g_dbus_connection_flush_sync (g_dbus_proxy_get_connection (G_DBUS_PROXY (proxy)),
-                                        NULL, NULL);
+          gvfs_metadata_call_move_sync (proxy,
+                                        metatreefile,
+                                        tree_path1,
+                                        tree_path2,
+                                        NULL,
+                                        NULL);
         }
     }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]