Clear want_write flag after responding to it.

Prevents busy loop after e.g. writing a large message when using TLS.

Thanks to Dave Sellars.
This commit is contained in:
Roger A. Light 2015-01-07 23:19:06 +00:00
parent d6bb6634d2
commit ac5dbd428f

View File

@ -841,6 +841,7 @@ int mosquitto_loop(struct mosquitto *mosq, int timeout, int max_packets)
#ifdef WITH_TLS #ifdef WITH_TLS
}else if(mosq->ssl && mosq->want_write){ }else if(mosq->ssl && mosq->want_write){
FD_SET(mosq->sock, &writefds); FD_SET(mosq->sock, &writefds);
mosq->want_write = false;
#endif #endif
} }
pthread_mutex_unlock(&mosq->out_packet_mutex); pthread_mutex_unlock(&mosq->out_packet_mutex);