Skip to content

Commit dd70d75

Browse files
luffykesh256dpi
authored andcommitted
extend keep alive interval to 100%
MQTT Specifications allows client a time of one and a half time the keep alive interval before sending the next control packet to keep the connection alive. > "If the Keep Alive value is non-zero and the Server does not receive a Control Packet from the Client within one and a half times the Keep Alive time period, it MUST disconnect the Network Connection to the Client as if the network had failed."
1 parent 466ea95 commit dd70d75

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/lwmqtt/client.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -357,8 +357,8 @@ lwmqtt_err_t lwmqtt_connect(lwmqtt_client_t *client, lwmqtt_options_t options, l
357357
// set command timer
358358
client->timer_set(client->command_timer, timeout);
359359

360-
// save keep alive interval (take 75% to be a little earlier than actually needed)
361-
client->keep_alive_interval = (uint32_t)(options.keep_alive) * 750;
360+
// save keep alive interval
361+
client->keep_alive_interval = (uint32_t)(options.keep_alive) * 1000;
362362

363363
// set keep alive timer
364364
client->timer_set(client->keep_alive_timer, client->keep_alive_interval);

0 commit comments

Comments
 (0)