Skip to content

Commit

Permalink
Workaround for Windows SSL (#160)
Browse files Browse the repository at this point in the history
Closes #154.

Signed-off-by: Dmitry Kaukov <[email protected]>
  • Loading branch information
dkaukov authored and ralight committed May 14, 2016
1 parent 6704df8 commit 606aa5b
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions lib/net_mosq.c
Original file line number Diff line number Diff line change
Expand Up @@ -375,15 +375,20 @@ int _mosquitto_try_connect(struct mosquitto *mosq, const char *host, uint16_t po
#ifdef WITH_TLS
int mosquitto__socket_connect_tls(struct mosquitto *mosq)
{
int ret;

int ret, err;
ret = SSL_connect(mosq->ssl);
if(ret != 1){
ret = SSL_get_error(mosq->ssl, ret);
if(ret == SSL_ERROR_WANT_READ){
if(ret != 1) {
err = SSL_get_error(mosq->ssl, ret);
#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;
/* 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_connect = true;
}else{
Expand Down

0 comments on commit 606aa5b

Please sign in to comment.