]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
IMAP in multi mode: use Curl_ssl_connect_nonblocking() when connecting.
authorBen Noordhuis <info@bnoordhuis.nl>
Mon, 14 Feb 2011 18:41:42 +0000 (19:41 +0100)
committerBen Noordhuis <info@bnoordhuis.nl>
Sun, 20 Feb 2011 20:11:12 +0000 (21:11 +0100)
lib/imap.c
lib/imap.h

index 5e294158b20d491726905190f7cebba5e881be99..4e71fb3edab0fad807c433d9d21840e9977df407 100644 (file)
@@ -588,7 +588,14 @@ static CURLcode imap_multi_statemach(struct connectdata *conn,
                                          bool *done)
 {
   struct imap_conn *imapc = &conn->proto.imapc;
-  CURLcode result = Curl_pp_multi_statemach(&imapc->pp);
+  CURLcode result;
+
+  if((conn->protocol & PROT_IMAPS) && !imapc->ssldone) {
+    result = Curl_ssl_connect_nonblocking(conn, FIRSTSOCKET, &imapc->ssldone);
+  }
+  else {
+    result = Curl_pp_multi_statemach(&imapc->pp);
+  }
 
   *done = (bool)(imapc->state == IMAP_STOP);
 
@@ -700,7 +707,7 @@ static CURLcode imap_connect(struct connectdata *conn,
   }
 #endif /* !CURL_DISABLE_HTTP && !CURL_DISABLE_PROXY */
 
-  if(conn->protocol & PROT_IMAPS) {
+  if((conn->protocol & PROT_IMAPS) && data->state.used_interface != Curl_if_multi) {
     /* BLOCKING */
     /* IMAPS is simply imap with SSL for the control channel */
     /* now, perform the SSL initialization for this socket */
index 2f0b62a61464a4c942642d29018f77747c922b63..ab4cf2f09067da50964a050df462d3b77f35d5f8 100644 (file)
@@ -47,6 +47,7 @@ struct imap_conn {
   imapstate state; /* always use imap.c:state() to change state! */
   int cmdid;       /* id number/index */
   const char *idstr; /* pointer to a string for which to wait for as id */
+  bool ssldone;      /* is connect() over SSL done? only relevant in multi mode */
 };
 
 extern const struct Curl_handler Curl_handler_imap;