Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Workaround for Windows SSL #160

Merged
merged 1 commit into from May 14, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 11 additions & 6 deletions lib/net_mosq.c
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