Merge pull request #7599 from HJianBo/merge-main-v4.3-into-v4.4
Merge main v4.3 into v4.4
This commit is contained in:
commit
a42de63791
|
@ -214,8 +214,19 @@
|
|||
end,
|
||||
Subscriptions = fun(Name) ->
|
||||
Configs = cuttlefish_variable:filter_by_prefix("bridge.mqtt." ++ Name ++ ".subscription", Conf),
|
||||
lists:zip([Topic || {_, Topic} <- lists:sort([{I, Topic} || {[_, _, _, "subscription", I, "topic"], Topic} <- Configs])],
|
||||
[QoS || {_, QoS} <- lists:sort([{I, QoS} || {[_, _, _, "subscription", I, "qos"], QoS} <- Configs])])
|
||||
Configs = cuttlefish_variable:filter_by_prefix("bridge.mqtt." ++ Name ++ ".subscription", Conf),
|
||||
SubConfId = lists:usort([{T, I} || {[_, _, _, "subscription", I, "topic"], T} <- Configs]),
|
||||
FindQoS = fun({T, I}) ->
|
||||
QoSFilter = fun
|
||||
({[_, _, _, "subscription", Index, "qos"], QoS}) -> I == Index andalso {true, QoS};
|
||||
(_Topic) -> false
|
||||
end,
|
||||
case lists:filtermap(QoSFilter, Configs) of
|
||||
[] -> {T, 0};
|
||||
QoSList -> {T, hd(QoSList)}
|
||||
end
|
||||
end,
|
||||
[FindQoS(TopicAndIndex) || TopicAndIndex <- SubConfId]
|
||||
end,
|
||||
IsNodeAddr = fun(Addr) ->
|
||||
case string:tokens(Addr, "@") of
|
||||
|
|
|
@ -2434,7 +2434,7 @@ end}.
|
|||
{translation, "emqx.shared_subscription_strategy_per_group", fun(Conf) ->
|
||||
Conf0 = cuttlefish_variable:filter_by_prefix("broker", Conf),
|
||||
Groups = lists:filtermap(fun({["broker", Group, "shared_subscription_strategy"], Strategy}) ->
|
||||
{true, {Group, Strategy}};
|
||||
{true, {Group, list_to_binary(Strategy)}};
|
||||
(_) ->
|
||||
false
|
||||
end, Conf0),
|
||||
|
|
|
@ -46,6 +46,8 @@ groups() ->
|
|||
t_parse_frame_malformed_variable_byte_integer,
|
||||
t_parse_frame_variable_byte_integer,
|
||||
t_parse_malformed_utf8_string,
|
||||
t_parse_empty_topic_name,
|
||||
t_parse_empty_topic_name_with_alias,
|
||||
t_parse_frame_proxy_protocol %% proxy_protocol_config_disabled packet.
|
||||
]},
|
||||
{connect, [parallel],
|
||||
|
@ -170,8 +172,12 @@ t_parse_empty_topic_name(_) ->
|
|||
t_parse_empty_topic_name_with_alias(_) ->
|
||||
Props = #{'Topic-Alias' => 16#AB},
|
||||
Packet = ?PUBLISH_PACKET(?QOS_1, <<>>, 1, Props, <<>>),
|
||||
?assertEqual(Packet, parse_serialize(Packet, #{strict_mode => false})),
|
||||
?assertEqual(Packet, parse_serialize(Packet, #{strict_mode => true})).
|
||||
?assertEqual(
|
||||
Packet, parse_serialize(Packet, #{strict_mode => false, version => ?MQTT_PROTO_V5})
|
||||
),
|
||||
?assertEqual(
|
||||
Packet, parse_serialize(Packet, #{strict_mode => true, version => ?MQTT_PROTO_V5})
|
||||
).
|
||||
|
||||
t_parse_frame_proxy_protocol(_) ->
|
||||
BinList = [ <<"PROXY TCP4 ">>, <<"PROXY TCP6 ">>, <<"PROXY UNKNOWN">>
|
||||
|
|
Loading…
Reference in New Issue