[gvfs/gnome-3-12] ftp: Also mark connection as unusable on G_IO_IN



commit 8c58ceb7d5f07fd007e21dae1557f35be92a56b6
Author: Benjamin Otte <otte redhat com>
Date:   Mon Aug 11 03:10:28 2014 +0200

    ftp: Also mark connection as unusable on G_IO_IN
    
    There is data waiting on an FTP connection and we didn't request it.
    It's not ours and we have no way to clear it. Just makr this connection
    as unusable.
    
    Most likely this is the server notifying us about a timeout or other
    connection abort, so it's a good idea to treat it as an error anyway.
    
    Also includes a new debug message for when we mark a connection as
    unusuable and why.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=591054

 daemon/gvfsftpconnection.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/daemon/gvfsftpconnection.c b/daemon/gvfsftpconnection.c
index 8576b48..edfffac 100644
--- a/daemon/gvfsftpconnection.c
+++ b/daemon/gvfsftpconnection.c
@@ -479,10 +479,16 @@ g_vfs_ftp_connection_is_usable (GVfsFtpConnection *conn)
   if (conn->waiting_for_reply)
     return FALSE;
 
-  cond = G_IO_ERR | G_IO_HUP;
+  cond = G_IO_ERR | G_IO_HUP | G_IO_IN;
   cond = g_socket_condition_check (g_socket_connection_get_socket (G_SOCKET_CONNECTION (conn->commands)), 
cond);
   if (cond)
-    return FALSE;
+    {
+      g_debug ("##%2d ##  connection unusuable: %s%s%s\r\n", conn->debug_id,
+                                                             cond & G_IO_IN ? "IN " : "",
+                                                             cond & G_IO_HUP ? "HUP " : "",
+                                                             cond & G_IO_ERR ? "ERR " : "");
+      return FALSE;
+    }
 
   return TRUE;
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]