SMTP in multi mode: use Curl_ssl_connect_nonblocking() when connecting.
This commit is contained in:
		
				
					committed by
					
						
						Daniel Stenberg
					
				
			
			
				
	
			
			
			
						parent
						
							14e8b13a45
						
					
				
				
					commit
					88e825de86
				
			
							
								
								
									
										13
									
								
								lib/smtp.c
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								lib/smtp.c
									
									
									
									
									
								
							@@ -999,7 +999,14 @@ static CURLcode smtp_multi_statemach(struct connectdata *conn,
 | 
				
			|||||||
                                     bool *done)
 | 
					                                     bool *done)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  struct smtp_conn *smtpc = &conn->proto.smtpc;
 | 
					  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);
 | 
					  *done = (bool)(smtpc->state == SMTP_STOP);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -1114,8 +1121,8 @@ static CURLcode smtp_connect(struct connectdata *conn,
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
#endif /* !CURL_DISABLE_HTTP && !CURL_DISABLE_PROXY */
 | 
					#endif /* !CURL_DISABLE_HTTP && !CURL_DISABLE_PROXY */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if(conn->handler->protocol & CURLPROTO_SMTPS) {
 | 
					  if((conn->handler->protocol & CURLPROTO_SMTPS) &&
 | 
				
			||||||
    /* BLOCKING */
 | 
					      data->state.used_interface != Curl_if_multi) {
 | 
				
			||||||
    /* SMTPS is simply smtp with SSL for the control channel */
 | 
					    /* SMTPS is simply smtp with SSL for the control channel */
 | 
				
			||||||
    /* now, perform the SSL initialization for this socket */
 | 
					    /* now, perform the SSL initialization for this socket */
 | 
				
			||||||
    result = Curl_ssl_connect(conn, FIRSTSOCKET);
 | 
					    result = Curl_ssl_connect(conn, FIRSTSOCKET);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -57,6 +57,7 @@ struct smtp_conn {
 | 
				
			|||||||
  unsigned int authmechs;       /* Accepted authentication methods. */
 | 
					  unsigned int authmechs;       /* Accepted authentication methods. */
 | 
				
			||||||
  smtpstate state; /* always use smtp.c:state() to change state! */
 | 
					  smtpstate state; /* always use smtp.c:state() to change state! */
 | 
				
			||||||
  struct curl_slist *rcpt;
 | 
					  struct curl_slist *rcpt;
 | 
				
			||||||
 | 
					  bool ssldone; /* is connect() over SSL done? only relevant in multi mode */
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Authentication mechanism flags. */
 | 
					/* Authentication mechanism flags. */
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user