mirror of https://github.com/eclipse/paho.mqtt.c
Better SSL socket connect handling
This commit is contained in:
parent
033e682c2f
commit
0e6c4e1605
|
|
@ -2424,8 +2424,11 @@ int MQTTAsync_connecting(MQTTAsyncs* m)
|
|||
if ((rc = SSL_set_session(m->c->net.ssl, m->c->session)) != 1)
|
||||
Log(TRACE_MIN, -1, "Failed to set SSL session with stored data, non critical");
|
||||
rc = SSLSocket_connect(m->c->net.ssl, m->c->net.socket);
|
||||
if (rc == -1)
|
||||
if (rc == TCPSOCKET_INTERRUPTED)
|
||||
{
|
||||
rc = MQTTCLIENT_SUCCESS; /* the connect is still in progress */
|
||||
m->c->connect_state = 2;
|
||||
}
|
||||
else if (rc == SSL_FATAL)
|
||||
{
|
||||
rc = SOCKET_ERROR;
|
||||
|
|
|
|||
|
|
@ -573,6 +573,8 @@ int SSLSocket_connect(SSL* ssl, int sock)
|
|||
error = SSLSocket_error("SSL_connect", ssl, sock, rc);
|
||||
if (error == SSL_FATAL)
|
||||
rc = error;
|
||||
if (error == SSL_ERROR_WANT_READ || error == SSL_ERROR_WANT_WRITE)
|
||||
rc = TCPSOCKET_INTERRUPTED;
|
||||
}
|
||||
|
||||
FUNC_EXIT_RC(rc);
|
||||
|
|
|
|||
Loading…
Reference in New Issue