[gvfs] ftp: GVfsJobPull: perform any cache lookups before opening data connection



commit 58dcf9fb5d25f292cc4c99b51c4263b2e23241be
Author: Tomas Bzatek <tbzatek redhat com>
Date:   Fri Feb 19 17:05:31 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 cf33d10..99aaef8 100644
--- a/daemon/gvfsbackendftp.c
+++ b/daemon/gvfsbackendftp.c
@@ -1398,6 +1398,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,
@@ -1431,16 +1441,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]