]> granicus.if.org Git - curl/commitdiff
SMTP in multi mode: use Curl_ssl_connect_nonblocking() when connecting.
authorBen Noordhuis <info@bnoordhuis.nl>
Wed, 16 Feb 2011 21:13:10 +0000 (22:13 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Tue, 15 Mar 2011 19:09:51 +0000 (20:09 +0100)
lib/smtp.c
lib/smtp.h

index 71a9c6e8a8962da0233339249a0183850018134f..8d24a628be9af0fad31ab8a2a1194954ff52e8e5 100644 (file)
@@ -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);
index 417fd52e5484afd3e35d4c1c207b2ecc5720b875..e9050f868680d31121d1a8fc81320c954820153f 100644 (file)
@@ -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. */