aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Noordhuis <info@bnoordhuis.nl>2011-02-16 22:13:10 +0100
committerDaniel Stenberg <daniel@haxx.se>2011-03-15 20:09:51 +0100
commit88e825de86b8ac95ac72c2b6b0131dded35de5f0 (patch)
treefe5232a761292bc6d8a07d05023422f0cc2b6658
parent14e8b13a45c4ba3f95d9717f6e84f67367e41ab7 (diff)
SMTP in multi mode: use Curl_ssl_connect_nonblocking() when connecting.
-rw-r--r--lib/smtp.c13
-rw-r--r--lib/smtp.h1
2 files changed, 11 insertions, 3 deletions
diff --git a/lib/smtp.c b/lib/smtp.c
index 71a9c6e8a..8d24a628b 100644
--- a/lib/smtp.c
+++ b/lib/smtp.c
@@ -999,7 +999,14 @@ static CURLcode smtp_multi_statemach(struct connectdata *conn,
bool *done)
{
struct smtp_conn *smtpc = &conn->proto.smtpc;
- CURLcode result = Curl_pp_multi_statemach(&smtpc->pp);
+ CURLcode result;
+
+ if((conn->handler->protocol & CURLPROTO_SMTPS) && !smtpc->ssldone) {
+ result = Curl_ssl_connect_nonblocking(conn, FIRSTSOCKET, &smtpc->ssldone);
+ }
+ else {
+ result = Curl_pp_multi_statemach(&smtpc->pp);
+ }
*done = (bool)(smtpc->state == SMTP_STOP);
@@ -1114,8 +1121,8 @@ static CURLcode smtp_connect(struct connectdata *conn,
}
#endif /* !CURL_DISABLE_HTTP && !CURL_DISABLE_PROXY */
- if(conn->handler->protocol & CURLPROTO_SMTPS) {
- /* BLOCKING */
+ if((conn->handler->protocol & CURLPROTO_SMTPS) &&
+ data->state.used_interface != Curl_if_multi) {
/* SMTPS is simply smtp with SSL for the control channel */
/* now, perform the SSL initialization for this socket */
result = Curl_ssl_connect(conn, FIRSTSOCKET);
diff --git a/lib/smtp.h b/lib/smtp.h
index 417fd52e5..e9050f868 100644
--- a/lib/smtp.h
+++ b/lib/smtp.h
@@ -57,6 +57,7 @@ struct smtp_conn {
unsigned int authmechs; /* Accepted authentication methods. */
smtpstate state; /* always use smtp.c:state() to change state! */
struct curl_slist *rcpt;
+ bool ssldone; /* is connect() over SSL done? only relevant in multi mode */
};
/* Authentication mechanism flags. */