From dfaa8137e7679a522ea7b3d7da7b38d7693cfb79 Mon Sep 17 00:00:00 2001 From: Moi Ran Date: Thu, 21 Sep 2023 12:32:35 +0800 Subject: [PATCH] * ADD [quic] Support mqttv5 over quic client Signed-off-by: Moi Ran --- nanomq/bridge.c | 6 ++---- nanomq_cli/client.c | 8 +++----- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/nanomq/bridge.c b/nanomq/bridge.c index e298e21fb..614ef03fc 100644 --- a/nanomq/bridge.c +++ b/nanomq/bridge.c @@ -519,8 +519,7 @@ hybrid_quic_client(bridge_param *bridge_arg) // keepalive here is for QUIC only if (node->proto_ver == MQTT_PROTOCOL_VERSION_v5) { - log_error("MQTT V5 OVER QUIC is not supported yet."); - if ((rv = nng_mqtt_quic_client_open(new)) != 0) { + if ((rv = nng_mqttv5_quic_client_open(new)) != 0) { nng_fatal("nng_mqttv5_quic_client_open", rv); return rv; } @@ -846,8 +845,7 @@ bridge_quic_client(nng_socket *sock, conf *config, conf_bridge_node *node, bridg log_debug("Quic bridge service start.\n"); if (node->proto_ver == MQTT_PROTOCOL_VERSION_v5) { - log_error("MQTT V5 OVER QUIC is not supported yet."); - if ((rv = nng_mqtt_quic_client_open(sock)) != 0) { + if ((rv = nng_mqttv5_quic_client_open(sock)) != 0) { nng_fatal("nng_mqttv5_quic_client_open", rv); return rv; } diff --git a/nanomq_cli/client.c b/nanomq_cli/client.c index 984a11899..d0547fecf 100644 --- a/nanomq_cli/client.c +++ b/nanomq_cli/client.c @@ -1462,11 +1462,9 @@ create_client(nng_socket *sock, struct work **works, size_t id, size_t nwork, if (isquic) { #if defined(SUPP_QUIC) - if (param->opts->version == MQTT_PROTOCOL_VERSION_v5) { - console("MQTT V5 OVER QUIC is not supported yet"); - return; - } - rv = nng_mqtt_quic_client_open(sock); + rv = param->opts->version == MQTT_PROTOCOL_VERSION_v5 + ? nng_mqttv5_quic_client_open(sock) + : nng_mqtt_quic_client_open(sock); if (rv != 0) { nng_fatal("nng_socket", rv); }