aboutsummaryrefslogtreecommitdiff
path: root/lib/ftp.c
diff options
context:
space:
mode:
authorKamil Dudka <kdudka@redhat.com>2010-11-19 13:43:20 +0100
committerKamil Dudka <kdudka@redhat.com>2010-12-06 14:35:42 +0100
commit5c7c9a768d009319520142fcaee1dea33625060f (patch)
treea8c31c739426e32edb76d9b86be951d9cb1191da /lib/ftp.c
parentbf1c102b80698e60972063b269f61ccbe2bfeaa8 (diff)
url: provide dead_connection flag in Curl_handler::disconnect
It helps to prevent a hangup with some FTP servers in case idle session timeout has exceeded. But it may be useful also for other protocols that send any quit message on disconnect. Currently used by FTP, POP3, IMAP and SMTP.
Diffstat (limited to 'lib/ftp.c')
-rw-r--r--lib/ftp.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/ftp.c b/lib/ftp.c
index 49e157138..8e370c5d2 100644
--- a/lib/ftp.c
+++ b/lib/ftp.c
@@ -136,7 +136,7 @@ static CURLcode ftp_do(struct connectdata *conn, bool *done);
static CURLcode ftp_done(struct connectdata *conn,
CURLcode, bool premature);
static CURLcode ftp_connect(struct connectdata *conn, bool *done);
-static CURLcode ftp_disconnect(struct connectdata *conn);
+static CURLcode ftp_disconnect(struct connectdata *conn, bool dead_connection);
static CURLcode ftp_nextconnect(struct connectdata *conn);
static CURLcode ftp_multi_statemach(struct connectdata *conn, bool *done);
static int ftp_getsock(struct connectdata *conn,
@@ -3840,7 +3840,7 @@ static CURLcode ftp_quit(struct connectdata *conn)
* Disconnect from an FTP server. Cleanup protocol-specific per-connection
* resources. BLOCKING.
*/
-static CURLcode ftp_disconnect(struct connectdata *conn)
+static CURLcode ftp_disconnect(struct connectdata *conn, bool dead_connection)
{
struct ftp_conn *ftpc= &conn->proto.ftpc;
struct pingpong *pp = &ftpc->pp;
@@ -3852,6 +3852,8 @@ static CURLcode ftp_disconnect(struct connectdata *conn)
ftp_quit() will check the state of ftp->ctl_valid. If it's ok it
will try to send the QUIT command, otherwise it will just return.
*/
+ if(dead_connection)
+ ftpc->ctl_valid = FALSE;
/* The FTP session may or may not have been allocated/setup at this point! */
(void)ftp_quit(conn); /* ignore errors on the QUIT */