0
0
Fork 0
mirror of https://github.com/netdata/netdata.git synced 2025-04-27 22:26:21 +00:00

Fix potential wait forever in mqtt loop ()

Make sure timer for next keep alive is not < 0
This commit is contained in:
Stelios Fragkakis 2024-10-31 19:00:29 +02:00 committed by GitHub
parent 97420bef49
commit 07975fe22d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -781,6 +781,8 @@ int mqtt_wss_service(mqtt_wss_client client, int timeout_ms)
// Check user requested TO doesn't interfere with MQTT keep alives
if (!ping_timeout) {
int till_next_keep_alive = t_till_next_keepalive_ms(client);
if (till_next_keep_alive < 0)
till_next_keep_alive = 0;
if (client->mqtt_connected && (timeout_ms < 0 || timeout_ms >= till_next_keep_alive)) {
timeout_ms = till_next_keep_alive;
send_keepalive = 1;