From 49bfe58cfc99959c17cfed826f7673ff795f05b9 Mon Sep 17 00:00:00 2001 From: Bret Ambrose Date: Tue, 26 Mar 2024 13:21:25 -0700 Subject: [PATCH] 0 keep alive to disable --- source/v5/mqtt5_client.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/source/v5/mqtt5_client.c b/source/v5/mqtt5_client.c index f74b45fa..e6da6d3d 100644 --- a/source/v5/mqtt5_client.c +++ b/source/v5/mqtt5_client.c @@ -1069,7 +1069,11 @@ static void s_reset_ping(struct aws_mqtt5_client *client) { uint64_t keep_alive_interval_nanos = aws_timestamp_convert(keep_alive_seconds, AWS_TIMESTAMP_SECS, AWS_TIMESTAMP_NANOS, NULL); - client->next_ping_time = aws_add_u64_saturating(now, keep_alive_interval_nanos); + if (keep_alive_interval_nanos == 0) { + client->next_ping_time = UINT64_MAX; + } else { + client->next_ping_time = aws_add_u64_saturating(now, keep_alive_interval_nanos); + } AWS_LOGF_DEBUG( AWS_LS_MQTT5_CLIENT, "id=%p: next PINGREQ scheduled for time %" PRIu64, (void *)client, client->next_ping_time);