In some circumstances, Mosquitto could leak memory when handling PUBLISH messages. This is limited to incoming QoS 2 messages, and is related to the combination of the broker having persistence enabled, a clean session=false client, which was connected prior to the broker restarting, then has reconnected and has now sent messages at a sufficiently high rate that the incoming queue at the broker has filled up and hence messages are being dropped. This is more likely to have an effect where max_queued_messages is a small value. This has now been fixed.
Closes#1793. Thanks to mbates14.
This fixes the following error, when compiling for systems without
pthread support, and when passing WITH_THREADING=no to make:
thread_mosq.c:24:12: fatal error: pthread.h: No such file or directory
# include <pthread.h>
^~~~~~~~~~~
compilation terminated.
Signed-off-by: Titouan Christophe <titouan.christophe@railnova.eu>
If we have e.g. max_inflight_messages set to 1000, and currently have 999 messages inflight, then when we send a new message to a client we have to iterate over the whole list to get to the newest message. This change means that we start of the back of the list to find the newest items, which reduces overhead.
New messages are now queued for clients when old ones are sent, rather than on every iteration of the main loop. This produces good performance improvements.
Rename mosquitto_plugin_publish() to mosquitto_broker_publish().
These two functions achieve the same thing. *_publish() publishes the payload and frees it later. *_publish_copy() takes a copy of the payload, so the plugin still owns the memory it passed to the function.
Fix clients not receiving messages after a previous client with the same client ID and positive will delay interval quit.
Closes#1752. Thanks to Jiří Zuzaňák.
keep v5 client read test to test for backwards compatability
adds username="usrname" and listener_port=1883 for v6 tests
Signed-off-by: david-beinder <david.beinder@mce.li>