mirror of
https://github.com/moparisthebest/curl
synced 2024-12-21 23:58:49 -05:00
email: Simplified the logout / quit functions
Moved the blocking state machine to the disconnect functions so that the logout / quit functions are only responsible for sending the actual command needed to logout or quit. Additionally removed the hard return on failure.
This commit is contained in:
parent
f691f9609c
commit
4838d196fd
12
lib/imap.c
12
lib/imap.c
@ -1950,13 +1950,10 @@ static CURLcode imap_logout(struct connectdata *conn)
|
|||||||
CURLcode result = CURLE_OK;
|
CURLcode result = CURLE_OK;
|
||||||
|
|
||||||
/* Send the LOGOUT command */
|
/* Send the LOGOUT command */
|
||||||
result = imap_sendf(conn, "LOGOUT", NULL);
|
result = imap_sendf(conn, "LOGOUT");
|
||||||
if(result)
|
|
||||||
return result;
|
|
||||||
|
|
||||||
state(conn, IMAP_LOGOUT);
|
if(!result)
|
||||||
|
state(conn, IMAP_LOGOUT);
|
||||||
result = imap_block_statemach(conn);
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -1979,7 +1976,8 @@ static CURLcode imap_disconnect(struct connectdata *conn, bool dead_connection)
|
|||||||
/* The IMAP session may or may not have been allocated/setup at this
|
/* The IMAP session may or may not have been allocated/setup at this
|
||||||
point! */
|
point! */
|
||||||
if(!dead_connection && imapc->pp.conn)
|
if(!dead_connection && imapc->pp.conn)
|
||||||
(void)imap_logout(conn); /* ignore errors on LOGOUT */
|
if(!imap_logout(conn))
|
||||||
|
(void)imap_block_statemach(conn); /* ignore errors on LOGOUT */
|
||||||
|
|
||||||
/* Disconnect from the server */
|
/* Disconnect from the server */
|
||||||
Curl_pp_disconnect(&imapc->pp);
|
Curl_pp_disconnect(&imapc->pp);
|
||||||
|
12
lib/pop3.c
12
lib/pop3.c
@ -1470,13 +1470,10 @@ static CURLcode pop3_quit(struct connectdata *conn)
|
|||||||
CURLcode result = CURLE_OK;
|
CURLcode result = CURLE_OK;
|
||||||
|
|
||||||
/* Send the QUIT command */
|
/* Send the QUIT command */
|
||||||
result = Curl_pp_sendf(&conn->proto.pop3c.pp, "QUIT", NULL);
|
result = Curl_pp_sendf(&conn->proto.pop3c.pp, "QUIT");
|
||||||
if(result)
|
|
||||||
return result;
|
|
||||||
|
|
||||||
state(conn, POP3_QUIT);
|
if(!result)
|
||||||
|
state(conn, POP3_QUIT);
|
||||||
result = pop3_block_statemach(conn);
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -1500,7 +1497,8 @@ static CURLcode pop3_disconnect(struct connectdata *conn,
|
|||||||
/* The POP3 session may or may not have been allocated/setup at this
|
/* The POP3 session may or may not have been allocated/setup at this
|
||||||
point! */
|
point! */
|
||||||
if(!dead_connection && pop3c->pp.conn)
|
if(!dead_connection && pop3c->pp.conn)
|
||||||
(void)pop3_quit(conn); /* ignore errors on QUIT */
|
if(!pop3_quit(conn))
|
||||||
|
(void)pop3_block_statemach(conn); /* ignore errors on QUIT */
|
||||||
|
|
||||||
/* Disconnect from the server */
|
/* Disconnect from the server */
|
||||||
Curl_pp_disconnect(&pop3c->pp);
|
Curl_pp_disconnect(&pop3c->pp);
|
||||||
|
10
lib/smtp.c
10
lib/smtp.c
@ -1501,12 +1501,9 @@ static CURLcode smtp_quit(struct connectdata *conn)
|
|||||||
|
|
||||||
/* Send the QUIT command */
|
/* Send the QUIT command */
|
||||||
result = Curl_pp_sendf(&conn->proto.smtpc.pp, "QUIT");
|
result = Curl_pp_sendf(&conn->proto.smtpc.pp, "QUIT");
|
||||||
if(result)
|
|
||||||
return result;
|
|
||||||
|
|
||||||
state(conn, SMTP_QUIT);
|
if(!result)
|
||||||
|
state(conn, SMTP_QUIT);
|
||||||
result = smtp_block_statemach(conn);
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -1530,7 +1527,8 @@ static CURLcode smtp_disconnect(struct connectdata *conn,
|
|||||||
/* The SMTP session may or may not have been allocated/setup at this
|
/* The SMTP session may or may not have been allocated/setup at this
|
||||||
point! */
|
point! */
|
||||||
if(!dead_connection && smtpc->pp.conn)
|
if(!dead_connection && smtpc->pp.conn)
|
||||||
(void)smtp_quit(conn); /* ignore errors on QUIT */
|
if(!smtp_quit(conn))
|
||||||
|
(void)smtp_block_statemach(conn); /* ignore errors on QUIT */
|
||||||
|
|
||||||
/* Disconnect from the server */
|
/* Disconnect from the server */
|
||||||
Curl_pp_disconnect(&smtpc->pp);
|
Curl_pp_disconnect(&smtpc->pp);
|
||||||
|
Loading…
Reference in New Issue
Block a user