mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-27 22:46:15 +01:00
only query file info in g_file_copy() when we need it
The default implementation of g_file_copy() checked the size of the file to copy to give useful progress updates unconditionally. This can cause long delays on 1-connection FTP servers while it tries to open a second connection before it returns EBUSY. This patch makes this query only happen when we actually send progress updates.
This commit is contained in:
parent
0bb5739f32
commit
29a4a0a44d
@ -2644,6 +2644,9 @@ copy_stream_with_progress (GInputStream *in,
|
||||
GFileInfo *info;
|
||||
|
||||
total_size = -1;
|
||||
/* avoid performance impact of querying total size when it's not needed */
|
||||
if (progress_callback)
|
||||
{
|
||||
info = g_file_input_stream_query_info (G_FILE_INPUT_STREAM (in),
|
||||
G_FILE_ATTRIBUTE_STANDARD_SIZE,
|
||||
cancellable, NULL);
|
||||
@ -2667,6 +2670,7 @@ copy_stream_with_progress (GInputStream *in,
|
||||
g_object_unref (info);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (total_size == -1)
|
||||
total_size = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user