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.
This commit is contained in:
Kamil Dudka
2010-11-19 13:43:20 +01:00
parent bf1c102b80
commit 5c7c9a768d
14 changed files with 47 additions and 35 deletions

View File

@@ -101,7 +101,7 @@ static CURLcode pop3_do(struct connectdata *conn, bool *done);
static CURLcode pop3_done(struct connectdata *conn,
CURLcode, bool premature);
static CURLcode pop3_connect(struct connectdata *conn, bool *done);
static CURLcode pop3_disconnect(struct connectdata *conn);
static CURLcode pop3_disconnect(struct connectdata *conn, bool dead_connection);
static CURLcode pop3_multi_statemach(struct connectdata *conn, bool *done);
static int pop3_getsock(struct connectdata *conn,
curl_socket_t *socks,
@@ -817,7 +817,7 @@ static CURLcode pop3_quit(struct connectdata *conn)
* Disconnect from an POP3 server. Cleanup protocol-specific per-connection
* resources. BLOCKING.
*/
static CURLcode pop3_disconnect(struct connectdata *conn)
static CURLcode pop3_disconnect(struct connectdata *conn, bool dead_connection)
{
struct pop3_conn *pop3c= &conn->proto.pop3c;
@@ -828,7 +828,7 @@ static CURLcode pop3_disconnect(struct connectdata *conn)
/* The POP3 session may or may not have been allocated/setup at this
point! */
if(pop3c->pp.conn)
if(!dead_connection && pop3c->pp.conn)
(void)pop3_quit(conn); /* ignore errors on the LOGOUT */