@cryptotaxi247 / netdata-1 / commits / 07975fe22

Fix potential wait forever in mqtt loop (#18913)

Make sure timer for next keep alive is not < 0

Stelios Fragkakis committed Oct 31, 2024 at 19:00 UTC 07975fe22d5721f685593d35f933853b0afcc4be
1 file changed +2
src/aclk/mqtt_websockets/mqtt_wss_client.c
+2
@@ -781,6 +781,8 @@ int mqtt_wss_service(mqtt_wss_client client, int timeout_ms)
781 // Check user requested TO doesn't interfere with MQTT keep alives
782 if (!ping_timeout) {
783 int till_next_keep_alive = t_till_next_keepalive_ms(client);
784 + if (till_next_keep_alive < 0)
785 + till_next_keep_alive = 0;
786 if (client->mqtt_connected && (timeout_ms < 0 || timeout_ms >= till_next_keep_alive)) {
787 timeout_ms = till_next_keep_alive;
788 send_keepalive = 1;