diff --git a/ChangeLog.txt b/ChangeLog.txt index 2612b520..a83bf84f 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -1,3 +1,7 @@ +Client library: +- mosq->want_write should be cleared immediately before a call to SSL_write, + to allow clients using mosquitto_want_write() to get accurate results. + 1.4.7 - 20151221 ================ diff --git a/lib/mosquitto.c b/lib/mosquitto.c index 195a25aa..cd40f775 100644 --- a/lib/mosquitto.c +++ b/lib/mosquitto.c @@ -863,7 +863,6 @@ int mosquitto_loop(struct mosquitto *mosq, int timeout, int max_packets) if(mosq->ssl){ if(mosq->want_write){ FD_SET(mosq->sock, &writefds); - mosq->want_write = false; }else if(mosq->want_connect){ /* Remove possible FD_SET from above, we don't want to check * for writing if we are still connecting, unless want_write is diff --git a/lib/net_mosq.c b/lib/net_mosq.c index 4c258a47..ccb717a3 100644 --- a/lib/net_mosq.c +++ b/lib/net_mosq.c @@ -712,6 +712,7 @@ ssize_t _mosquitto_net_write(struct mosquitto *mosq, void *buf, size_t count) errno = 0; #ifdef WITH_TLS if(mosq->ssl){ + mosq->want_write = false; ret = SSL_write(mosq->ssl, buf, count); if(ret < 0){ err = SSL_get_error(mosq->ssl, ret);