1
0
mirror of https://github.com/moparisthebest/curl synced 2024-10-31 15:45:12 -04:00

imap/pop3/smtp: Speed up SSL connection initialization

Don't wait for the next callback call (usually 1 second) before
continuing with protocol specific connection initialization.
This commit is contained in:
Jiri Hruska 2013-09-10 20:40:11 +02:00 committed by Steve Holme
parent 2879ffacfa
commit 5c14a7f068
4 changed files with 16 additions and 9 deletions

View File

@ -42,6 +42,7 @@ This release includes the following bugfixes:
o curl_easy_pause: suggest one way to unpause o curl_easy_pause: suggest one way to unpause
o imap: Fixed calculation of transfer when partial FETCH received [16] o imap: Fixed calculation of transfer when partial FETCH received [16]
o pingpong: Check SSL library buffers for already read data [16] o pingpong: Check SSL library buffers for already read data [16]
o imap/pop3/smtp: Speed up SSL connection initialization
This release includes the following known bugs: This release includes the following known bugs:

View File

@ -1704,11 +1704,13 @@ static CURLcode imap_multi_statemach(struct connectdata *conn, bool *done)
CURLcode result = CURLE_OK; CURLcode result = CURLE_OK;
struct imap_conn *imapc = &conn->proto.imapc; struct imap_conn *imapc = &conn->proto.imapc;
if((conn->handler->flags & PROTOPT_SSL) && !imapc->ssldone) if((conn->handler->flags & PROTOPT_SSL) && !imapc->ssldone) {
result = Curl_ssl_connect_nonblocking(conn, FIRSTSOCKET, &imapc->ssldone); result = Curl_ssl_connect_nonblocking(conn, FIRSTSOCKET, &imapc->ssldone);
else if(result || !imapc->ssldone)
result = Curl_pp_statemach(&imapc->pp, FALSE); return result;
}
result = Curl_pp_statemach(&imapc->pp, FALSE);
*done = (imapc->state == IMAP_STOP) ? TRUE : FALSE; *done = (imapc->state == IMAP_STOP) ? TRUE : FALSE;
return result; return result;

View File

@ -1368,11 +1368,13 @@ static CURLcode pop3_multi_statemach(struct connectdata *conn, bool *done)
CURLcode result = CURLE_OK; CURLcode result = CURLE_OK;
struct pop3_conn *pop3c = &conn->proto.pop3c; struct pop3_conn *pop3c = &conn->proto.pop3c;
if((conn->handler->flags & PROTOPT_SSL) && !pop3c->ssldone) if((conn->handler->flags & PROTOPT_SSL) && !pop3c->ssldone) {
result = Curl_ssl_connect_nonblocking(conn, FIRSTSOCKET, &pop3c->ssldone); result = Curl_ssl_connect_nonblocking(conn, FIRSTSOCKET, &pop3c->ssldone);
else if(result || !pop3c->ssldone)
result = Curl_pp_statemach(&pop3c->pp, FALSE); return result;
}
result = Curl_pp_statemach(&pop3c->pp, FALSE);
*done = (pop3c->state == POP3_STOP) ? TRUE : FALSE; *done = (pop3c->state == POP3_STOP) ? TRUE : FALSE;
return result; return result;

View File

@ -1392,11 +1392,13 @@ static CURLcode smtp_multi_statemach(struct connectdata *conn, bool *done)
CURLcode result = CURLE_OK; CURLcode result = CURLE_OK;
struct smtp_conn *smtpc = &conn->proto.smtpc; struct smtp_conn *smtpc = &conn->proto.smtpc;
if((conn->handler->flags & PROTOPT_SSL) && !smtpc->ssldone) if((conn->handler->flags & PROTOPT_SSL) && !smtpc->ssldone) {
result = Curl_ssl_connect_nonblocking(conn, FIRSTSOCKET, &smtpc->ssldone); result = Curl_ssl_connect_nonblocking(conn, FIRSTSOCKET, &smtpc->ssldone);
else if(result || !smtpc->ssldone)
result = Curl_pp_statemach(&smtpc->pp, FALSE); return result;
}
result = Curl_pp_statemach(&smtpc->pp, FALSE);
*done = (smtpc->state == SMTP_STOP) ? TRUE : FALSE; *done = (smtpc->state == SMTP_STOP) ? TRUE : FALSE;
return result; return result;