summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2013-12-21 03:22:12 +0100
committerBenjamin Otte <otte@redhat.com>2013-12-21 13:36:51 +0100
commit0d30b628990db246a7a9fec4c43e4ca3a5df46b0 (patch)
tree4dc2c7761a2d63cda041d71e18f8656530964f34
parentf41ae46501ef0e5516412d17556aae9075656f11 (diff)
downloadgvfs-0d30b628990db246a7a9fec4c43e4ca3a5df46b0.tar.gz
ftp: Always close data connections when done
Opening data connections is a complex process and can fail in multiple stages. Instead of requiring the code to close them manually and throwing assertions when that doesn't work we just clean up after all jobs automatically. https://bugzilla.gnome.org/show_bug.cgi?id=711865
-rw-r--r--daemon/gvfsftptask.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/daemon/gvfsftptask.c b/daemon/gvfsftptask.c
index 15de4ce4..185ffe25 100644
--- a/daemon/gvfsftptask.c
+++ b/daemon/gvfsftptask.c
@@ -276,6 +276,8 @@ g_vfs_ftp_task_acquire_connection (GVfsFtpTask *task)
* or frees it if it is in an error state. You must use this function to free
* a @task's connection, never use g_vfs_ftp_connection_free() directly. If
* the task does not have a current connection, this function just returns.
+ *
+ * This function also closes all potentially open data connections.
**/
static void
g_vfs_ftp_task_release_connection (GVfsFtpTask *task)
@@ -286,6 +288,8 @@ g_vfs_ftp_task_release_connection (GVfsFtpTask *task)
if (task->conn == NULL)
return;
+ g_vfs_ftp_task_close_data_connection (task);
+
g_mutex_lock (&task->backend->mutex);
if (task->backend->queue && g_vfs_ftp_connection_is_usable (task->conn))
{