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:24:29 +0100
commit28cf48f6ea1cd6885b7853aa3b430d5ab846c3ab (patch)
tree7acffc4be75f8b5ce56ae36ab6798e83f3a7350e
parent490b23019fa1ae2744bb1efc9b620485343bcfb4 (diff)
downloadgvfs-28cf48f6ea1cd6885b7853aa3b430d5ab846c3ab.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))
{