Commit 0e6c4e16 authored by Ian Craggs's avatar Ian Craggs

Better SSL socket connect handling

parent 033e682c
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment