From 52e79edf2b42d0616aa45843b1b7010d980a24c0 Mon Sep 17 00:00:00 2001 From: donghui1277 Date: Mon, 5 Aug 2024 11:06:14 +0800 Subject: [PATCH] chagne quic keepalive less than idle_timeout, current config will cause connection_idle and reconnect --- demo/quic_mqtt/quic_client.c | 4 ++-- demo/quic_mqttv5/quic_client_v5.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/demo/quic_mqtt/quic_client.c b/demo/quic_mqtt/quic_client.c index 4c1c79ef..a214667c 100644 --- a/demo/quic_mqtt/quic_client.c +++ b/demo/quic_mqtt/quic_client.c @@ -61,7 +61,7 @@ conf_quic config_user = { }, .multi_stream = false, .qos_first = false, - .qkeepalive = 30, + .qkeepalive = 10, .qconnect_timeout = 60, .qdiscon_timeout = 30, .qidle_timeout = 30, @@ -84,7 +84,7 @@ mqtt_msg_compose(int type, int qos, char *topic, char *payload) nng_mqtt_msg_set_packet_type(msg, NNG_MQTT_CONNECT); nng_mqtt_msg_set_connect_proto_version(msg, 4); - nng_mqtt_msg_set_connect_keep_alive(msg, 30); + nng_mqtt_msg_set_connect_keep_alive(msg, 10); nng_mqtt_msg_set_connect_clean_session(msg, true); } else if (type == SUB) { nng_mqtt_msg_set_packet_type(msg, NNG_MQTT_SUBSCRIBE); diff --git a/demo/quic_mqttv5/quic_client_v5.c b/demo/quic_mqttv5/quic_client_v5.c index 910736b6..a7ded7f5 100644 --- a/demo/quic_mqttv5/quic_client_v5.c +++ b/demo/quic_mqttv5/quic_client_v5.c @@ -61,7 +61,7 @@ conf_quic config_user = { }, .multi_stream = false, .qos_first = false, - .qkeepalive = 30, + .qkeepalive = 10, .qconnect_timeout = 60, .qdiscon_timeout = 30, .qidle_timeout = 30, @@ -145,7 +145,7 @@ compose_connect() nng_mqtt_msg_set_connect_property(msg, p); nng_mqtt_msg_set_connect_proto_version(msg, MQTT_PROTOCOL_VERSION_v5); - nng_mqtt_msg_set_connect_keep_alive(msg, 30); + nng_mqtt_msg_set_connect_keep_alive(msg, 10); nng_mqtt_msg_set_connect_clean_session(msg, true); return msg;