mosq->want_write should be cleared immediately before a call to SSL_write.

This allows clients using mosquitto_want_write() to get accurate results.
pull/145/head
Roger A. Light 10 years ago
parent 51f275bd02
commit c7d4f4bcff

@ -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 1.4.7 - 20151221
================ ================

@ -863,7 +863,6 @@ int mosquitto_loop(struct mosquitto *mosq, int timeout, int max_packets)
if(mosq->ssl){ if(mosq->ssl){
if(mosq->want_write){ if(mosq->want_write){
FD_SET(mosq->sock, &writefds); FD_SET(mosq->sock, &writefds);
mosq->want_write = false;
}else if(mosq->want_connect){ }else if(mosq->want_connect){
/* Remove possible FD_SET from above, we don't want to check /* Remove possible FD_SET from above, we don't want to check
* for writing if we are still connecting, unless want_write is * for writing if we are still connecting, unless want_write is

@ -712,6 +712,7 @@ ssize_t _mosquitto_net_write(struct mosquitto *mosq, void *buf, size_t count)
errno = 0; errno = 0;
#ifdef WITH_TLS #ifdef WITH_TLS
if(mosq->ssl){ if(mosq->ssl){
mosq->want_write = false;
ret = SSL_write(mosq->ssl, buf, count); ret = SSL_write(mosq->ssl, buf, count);
if(ret < 0){ if(ret < 0){
err = SSL_get_error(mosq->ssl, ret); err = SSL_get_error(mosq->ssl, ret);

Loading…
Cancel
Save