[gvfs/gnome-2-28] ftp: GVfsJobPull: perform any cache lookups before opening data connection



commit abafe47c540eff4da478a13e4e4d3e62ca61aefb
Author: Tomas Bzatek <tbzatek redhat com>
Date:   Fri Feb 19 17:05:51 2010 +0100

    ftp: GVfsJobPull: perform any cache lookups before opening data connection
    
    After the delete op, cache was invalidated and an attempt was made to retrieve
    file size in do_pull() while data connection was already opened. This patch
    only moves all necessary operations before setting up actual data stream for
    download.
    
    Fixes bug 610395

 daemon/gvfsbackendftp.c |   20 ++++++++++----------
 1 files changed, 10 insertions(+), 10 deletions(-)
---
diff --git a/daemon/gvfsbackendftp.c b/daemon/gvfsbackendftp.c
index 5dfaa4c..fa44fbc 100644
--- a/daemon/gvfsbackendftp.c
+++ b/daemon/gvfsbackendftp.c
@@ -1339,6 +1339,16 @@ do_pull (GVfsBackend *         backend,
   src = g_vfs_ftp_file_new_from_gvfs (ftp, source);
   dest = g_file_new_for_path (local_path);
 
+  if (progress_callback)
+    {
+      GFileInfo *info = g_vfs_ftp_dir_cache_lookup_file (ftp->dir_cache, &task, src, TRUE);
+      if (info)
+        {
+          total_size = g_file_info_get_size (info);
+          g_object_unref (info);
+        }
+    }
+
   g_vfs_ftp_task_setup_data_connection (&task);
   g_vfs_ftp_task_send_and_check (&task,
                                  G_VFS_FTP_PASS_100 | G_VFS_FTP_FAIL_200,
@@ -1372,16 +1382,6 @@ do_pull (GVfsBackend *         backend,
       goto out;
     }
 
-  if (progress_callback)
-    {
-      GFileInfo *info = g_vfs_ftp_dir_cache_lookup_file (ftp->dir_cache, &task, src, TRUE);
-      if (info)
-        {
-          total_size = g_file_info_get_size (info);
-          g_object_unref (info);
-        }
-    }
-
   input = g_io_stream_get_input_stream (g_vfs_ftp_connection_get_data_stream (task.conn));
   ftp_output_stream_splice (output,
                             input,



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