always-multi: always use non-blocking internals

Remove internal separated behavior of the easy vs multi intercace.
curl_easy_perform() is now using the multi interface itself.

Several minor multi interface quirks and bugs have been fixed in the
process.

Much help with debugging this has been provided by: Yang Tse
This commit is contained in:
Daniel Stenberg
2013-01-17 12:59:23 +01:00
parent 9fd88abb70
commit c43127414d
54 changed files with 490 additions and 884 deletions

View File

@@ -493,17 +493,8 @@ static CURLcode smtp_state_starttls_resp(struct connectdata *conn,
result = smtp_authenticate(conn);
}
else {
if(data->state.used_interface == Curl_if_multi) {
state(conn, SMTP_UPGRADETLS);
result = smtp_state_upgrade_tls(conn);
}
else {
result = Curl_ssl_connect(conn, FIRSTSOCKET);
if(CURLE_OK == result) {
smtp_to_smtps(conn);
result = smtp_state_ehlo(conn);
}
}
state(conn, SMTP_UPGRADETLS);
return smtp_state_upgrade_tls(conn);
}
return result;
@@ -1300,7 +1291,6 @@ static CURLcode smtp_connect(struct connectdata *conn, bool *done)
{
CURLcode result;
struct smtp_conn *smtpc = &conn->proto.smtpc;
struct SessionHandle *data = conn->data;
struct pingpong *pp = &smtpc->pp;
const char *path = conn->data->state.path;
char localhost[HOSTNAME_MAX + 1];
@@ -1323,15 +1313,6 @@ static CURLcode smtp_connect(struct connectdata *conn, bool *done)
pp->endofresp = smtp_endofresp;
pp->conn = conn;
if((conn->handler->protocol & CURLPROTO_SMTPS) &&
data->state.used_interface != Curl_if_multi) {
/* SMTPS is simply smtp with SSL for the control channel */
/* so perform the SSL initialization for this socket */
result = Curl_ssl_connect(conn, FIRSTSOCKET);
if(result)
return result;
}
/* Initialise the response reader stuff */
Curl_pp_init(pp);
@@ -1357,13 +1338,7 @@ static CURLcode smtp_connect(struct connectdata *conn, bool *done)
/* Start off waiting for the server greeting response */
state(conn, SMTP_SERVERGREET);
if(data->state.used_interface == Curl_if_multi)
result = smtp_multi_statemach(conn, done);
else {
result = smtp_easy_statemach(conn);
if(!result)
*done = TRUE;
}
result = smtp_multi_statemach(conn, done);
return result;
}
@@ -1470,13 +1445,9 @@ static CURLcode smtp_perform(struct connectdata *conn, bool *connected,
if(result)
return result;
/* Run the state-machine */
if(conn->data->state.used_interface == Curl_if_multi)
result = smtp_multi_statemach(conn, dophase_done);
else {
result = smtp_easy_statemach(conn);
*dophase_done = TRUE; /* with the easy interface we are done here */
}
/* run the state-machine */
result = smtp_multi_statemach(conn, dophase_done);
*connected = conn->bits.tcpconnect[FIRSTSOCKET];
if(*dophase_done)