diff options
author | Benjamin Otte <otte@gnome.org> | 2008-03-28 16:15:31 +0000 |
---|---|---|
committer | Benjamin Otte <otte@src.gnome.org> | 2008-03-28 16:15:31 +0000 |
commit | c3a3a4d6a917eb466fcbdcb15899ddbe7e247099 (patch) | |
tree | c20f2d396eef92f6aed70a9530a4fd9481b4c08d | |
parent | ee1e9e23ad6d5c87fca38ae328dc67d480b8dc50 (diff) | |
download | gvfs-c3a3a4d6a917eb466fcbdcb15899ddbe7e247099.tar.gz |
fix race that could cause uploads to stop
2008-03-28 Benjamin Otte <otte@gnome.org>
* daemon/gvfsbackendftp.c: (ftp_connection_pop_job):
fix race that could cause uploads to stop
svn path=/trunk/; revision=1696
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | daemon/gvfsbackendftp.c | 20 |
2 files changed, 20 insertions, 5 deletions
@@ -1,3 +1,8 @@ +2008-03-28 Benjamin Otte <otte@gnome.org> + + * daemon/gvfsbackendftp.c: (ftp_connection_pop_job): + fix race that could cause uploads to stop + 2008-03-28 Alexander Larsson <alexl@redhat.com> * configure.ac: diff --git a/daemon/gvfsbackendftp.c b/daemon/gvfsbackendftp.c index 853670af..788c8ac4 100644 --- a/daemon/gvfsbackendftp.c +++ b/daemon/gvfsbackendftp.c @@ -173,22 +173,32 @@ static gboolean ftp_connection_pop_job (FtpConnection *conn) { gboolean result; + GError *error; + GVfsJob *job; g_return_val_if_fail (conn->job != NULL, FALSE); - if (ftp_connection_in_error (conn)) + /* sending a reply is racy after the reply is sent. The connection may be + * reused in a different thread before the reply sending returns. This is + * racy in particular when the connection is used as a read/write handle. + */ + error = conn->error; + conn->error = NULL; + job = conn->job; + conn->job = NULL; + + if (error) { - g_vfs_job_failed_from_error (conn->job, conn->error); - g_clear_error (&conn->error); + g_vfs_job_failed_from_error (job, error); + g_clear_error (&error); result = FALSE; } else { - g_vfs_job_succeeded (conn->job); + g_vfs_job_succeeded (job); result = TRUE; } - conn->job = NULL; return result; } |