From cf22692c74753c4f09f6e5748f2dc1752717e1ca Mon Sep 17 00:00:00 2001 From: "Zaiming (Stone) Shi" Date: Thu, 8 Feb 2024 17:05:16 +0100 Subject: [PATCH] fix(emqx_channel): return Receive-Maximum in CONNACK when no error --- apps/emqx/src/emqx_channel.erl | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/apps/emqx/src/emqx_channel.erl b/apps/emqx/src/emqx_channel.erl index 4d6ed37e4..bb9c84e8c 100644 --- a/apps/emqx/src/emqx_channel.erl +++ b/apps/emqx/src/emqx_channel.erl @@ -2007,14 +2007,15 @@ merge_default_subopts(SubOpts) -> %%-------------------------------------------------------------------- %% Enrich ConnAck Caps -enrich_connack_caps( - AckProps, - ?IS_MQTT_V5 = #channel{ +enrich_connack_caps(AckProps, ?IS_MQTT_V5 = Channel) -> + #channel{ clientinfo = #{ zone := Zone + }, + conninfo = #{ + receive_maximum := ReceiveMaximum } - } -) -> + } = Channel, #{ max_packet_size := MaxPktSize, max_qos_allowed := MaxQoS, @@ -2029,7 +2030,8 @@ enrich_connack_caps( 'Topic-Alias-Maximum' => MaxAlias, 'Wildcard-Subscription-Available' => flag(Wildcard), 'Subscription-Identifier-Available' => 1, - 'Shared-Subscription-Available' => flag(Shared) + 'Shared-Subscription-Available' => flag(Shared), + 'Receive-Maximum' => ReceiveMaximum }, %% MQTT 5.0 - 3.2.2.3.4: %% It is a Protocol Error to include Maximum QoS more than once,