summaryrefslogtreecommitdiff
path: root/daemon/gvfsbackendftp.h
diff options
context:
space:
mode:
authorBenjamin Otte <otte@gnome.org>2009-06-12 14:22:16 +0200
committerBenjamin Otte <otte@gnome.org>2009-06-12 14:41:12 +0200
commitb18516a92cb5306b6f73de83e74a9af7ddd781c0 (patch)
tree0ce00fc24afa2f929a312b26b0ce50d3fdb59003 /daemon/gvfsbackendftp.h
parent1ef4f0d82da583c97c93052b6e4ccc632351746d (diff)
downloadgvfs-b18516a92cb5306b6f73de83e74a9af7ddd781c0.tar.gz
[FTP] rework data connection code
The new code doesn't rely on funny workaround flags anymore and also doesn't set workaround flags unconditionally after any failure. It now works like this: 1) if a default method exists, try the default method. 2) if the default method failed, try all methods in order until one succeeds. 3) if any method succeeded, make it the new default method. This way, we take the proper method by default, and have a proper fallback mechanism for flaky connections/servers that sometimes fail to connect properly. Also, it's much easier to add new methods (like active FTP) later.
Diffstat (limited to 'daemon/gvfsbackendftp.h')
-rw-r--r--daemon/gvfsbackendftp.h17
1 files changed, 10 insertions, 7 deletions
diff --git a/daemon/gvfsbackendftp.h b/daemon/gvfsbackendftp.h
index 4e6b4014..89b2769d 100644
--- a/daemon/gvfsbackendftp.h
+++ b/daemon/gvfsbackendftp.h
@@ -46,13 +46,15 @@ typedef enum {
} GVfsFtpSystem;
typedef enum {
- /* Server advertises support for EPSV (or we assume that it supports it),
- * but it does fail to do so, we set this flag so we can fall back to
- * PASV. */
- G_VFS_FTP_WORKAROUND_BROKEN_EPSV,
- /* Server replies with a wrong address in PASV, we use connection IP
- * instead */
- G_VFS_FTP_WORKAROUND_PASV_ADDR,
+ G_VFS_FTP_METHOD_ANY = 0,
+ G_VFS_FTP_METHOD_EPSV,
+ G_VFS_FTP_METHOD_PASV,
+ G_VFS_FTP_METHOD_PASV_ADDR,
+ G_VFS_FTP_METHOD_EPRT,
+ G_VFS_FTP_METHOD_PORT
+} GVfsFtpMethod;
+
+typedef enum {
/* server does not allow querying features before login, so we try after
* logging in instead. */
G_VFS_FTP_WORKAROUND_FEAT_AFTER_LOGIN,
@@ -86,6 +88,7 @@ struct _GVfsBackendFtp
GVfsFtpSystem system; /* the system from the SYST response */
int features; /* GVfsFtpFeatures that are supported */
int workarounds; /* GVfsFtpWorkarounds in use - int because it's atomic */
+ int method; /* preferred GVfsFtpMethod - int because it's atomic */
/* directory cache */
const GVfsFtpDirFuncs *dir_funcs; /* functions used in directory cache */