From ac5dbd428fa147c89fbc5157c39b58f6836c7900 Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Wed, 7 Jan 2015 23:19:06 +0000 Subject: [PATCH] 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. --- lib/mosquitto.c | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/mosquitto.c b/lib/mosquitto.c index 0b89b42c..0a289869 100644 --- a/lib/mosquitto.c +++ b/lib/mosquitto.c @@ -841,6 +841,7 @@ int mosquitto_loop(struct mosquitto *mosq, int timeout, int max_packets) #ifdef WITH_TLS }else if(mosq->ssl && mosq->want_write){ FD_SET(mosq->sock, &writefds); + mosq->want_write = false; #endif } pthread_mutex_unlock(&mosq->out_packet_mutex);