Workaround for Windows SSL (#160)

Closes #154.

Signed-off-by: Dmitry Kaukov <dkaukov@opentable.com>
pull/198/head
Dmitry Kaukov 10 years ago committed by Roger Light
parent 6704df8061
commit 606aa5b4fa

@ -375,15 +375,20 @@ int _mosquitto_try_connect(struct mosquitto *mosq, const char *host, uint16_t po
#ifdef WITH_TLS #ifdef WITH_TLS
int mosquitto__socket_connect_tls(struct mosquitto *mosq) int mosquitto__socket_connect_tls(struct mosquitto *mosq)
{ {
int ret; int ret, err;
ret = SSL_connect(mosq->ssl); ret = SSL_connect(mosq->ssl);
if(ret != 1){ if(ret != 1) {
ret = SSL_get_error(mosq->ssl, ret); err = SSL_get_error(mosq->ssl, ret);
if(ret == SSL_ERROR_WANT_READ){ #ifdef WIN32
if (err == SSL_ERROR_SYSCALL) {
mosq->want_connect = true;
return MOSQ_ERR_SUCCESS;
}
#endif
if(err == SSL_ERROR_WANT_READ){
mosq->want_connect = true; mosq->want_connect = true;
/* We always try to read anyway */ /* We always try to read anyway */
}else if(ret == SSL_ERROR_WANT_WRITE){ }else if(err == SSL_ERROR_WANT_WRITE){
mosq->want_write = true; mosq->want_write = true;
mosq->want_connect = true; mosq->want_connect = true;
}else{ }else{

Loading…
Cancel
Save