mirror of
https://github.com/netdata/netdata.git
synced 2025-04-27 22:26:21 +00:00
Fix potential wait forever in mqtt loop (#18913)
Make sure timer for next keep alive is not < 0
This commit is contained in:
parent
97420bef49
commit
07975fe22d
1 changed files with 2 additions and 0 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue