Merge pull request #8349 from emqx/copy-of_main-v4.3
merge main-v4.3 into main-v4.4
This commit is contained in:
commit
3c1251a99a
|
@ -171,7 +171,7 @@ on_client_subscribe(#{clientid := ClientId, username := Username}, _Properties,
|
|||
case on_client_subscribe_single(ClientId, Username, TopicFilter, LuaState) of
|
||||
false ->
|
||||
{Topic, Opts} = TopicFilter,
|
||||
[{Topic, Opts#{delete => true}} | Acc];
|
||||
[{Topic, Opts#{deny_subscription => true}} | Acc];
|
||||
NewTopicFilter ->
|
||||
[NewTopicFilter | Acc]
|
||||
end
|
||||
|
|
|
@ -711,7 +711,7 @@ t_stop_sub(_Config) ->
|
|||
OriginalTopicFilters = [{Topic = <<"u">>,
|
||||
Opts = #{nl => 0,qos => 0,rap => 0,rh => 0}}],
|
||||
Props = #{},
|
||||
Expected = [{Topic, Opts#{delete => true}}],
|
||||
Expected = [{Topic, Opts#{deny_subscription => true}}],
|
||||
?assertEqual(Expected, emqx_hooks:run_fold('client.subscribe',
|
||||
[ClientInfo, Props],
|
||||
OriginalTopicFilters)).
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
%% -*- mode: erlang -*-
|
||||
{VSN,
|
||||
[{<<".*">>,
|
||||
[{apply,{minirest,stop_http,['http:management']}},
|
||||
[%% Stop the http listener to load the latest http handlers.
|
||||
%% We can only stop these listeners here because we can't get the list of
|
||||
%% currently started http listener via app-env during the hot upgrade.
|
||||
{apply,{minirest,stop_http,['http:management']}},
|
||||
{apply,{minirest,stop_http,['https:management']}},
|
||||
{restart_application, emqx_management}]}],
|
||||
[{<<".*">>,
|
||||
|
|
|
@ -85,6 +85,8 @@ listeners() ->
|
|||
application:get_env(?APP, listeners, []).
|
||||
|
||||
listener_name(Proto) ->
|
||||
%% NOTE: this name has referenced by emqx_management.appup.src.
|
||||
%% Please don't change it except you have got how to handle it in hot-upgrade
|
||||
list_to_atom(atom_to_list(Proto) ++ ":management").
|
||||
|
||||
http_handlers() ->
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
|
||||
-ifndef(EMQX_ENTERPRISE).
|
||||
|
||||
-define(EMQX_RELEASE, {opensource, "4.4.5-beta.3"}).
|
||||
-define(EMQX_RELEASE, {opensource, "4.4.5-beta.4"}).
|
||||
|
||||
-else.
|
||||
|
||||
|
|
|
@ -1,11 +1,21 @@
|
|||
%% -*- mode: erlang -*-
|
||||
{VSN,
|
||||
[ {<<".*">>,
|
||||
[ {restart_application, emqx_dashboard}
|
||||
[ %% Stop the http listener to load the latest http handlers.
|
||||
%% We can only stop these listeners here because we can't get the list of
|
||||
%% currently started http listener via app-env during the hot upgrade.
|
||||
{apply, {minirest, stop_http, ['http:dashboard']}}
|
||||
, {apply, {minirest, stop_http, ['https:dashboard']}}
|
||||
, {restart_application, emqx_dashboard}
|
||||
]}
|
||||
],
|
||||
[ {<<".*">>,
|
||||
[ {restart_application, emqx_dashboard}
|
||||
[ %% Stop the http listener to load the latest http handlers.
|
||||
%% We can only stop these listeners here because we can't get the list of
|
||||
%% currently started http listener via app-env during the hot upgrade.
|
||||
{apply, {minirest, stop_http, ['http:dashboard']}}
|
||||
, {apply, {minirest, stop_http, ['https:dashboard']}}
|
||||
, {restart_application, emqx_dashboard}
|
||||
]}
|
||||
]
|
||||
}.
|
||||
|
|
|
@ -80,6 +80,8 @@ listeners() ->
|
|||
application:get_env(?APP, listeners, []).
|
||||
|
||||
listener_name(Proto) ->
|
||||
%% NOTE: this name has referenced by emqx_dashboard.appup.src.
|
||||
%% Please don't change it except you have got how to handle it in hot-upgrade
|
||||
list_to_atom(atom_to_list(Proto) ++ ":dashboard").
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
|
|
|
@ -450,9 +450,9 @@ handle_in(Packet = ?SUBSCRIBE_PACKET(PacketId, Properties, TopicFilters),
|
|||
Channel),
|
||||
TupleTopicFilters2 =
|
||||
lists:foldl(
|
||||
fun({{Topic, Opts = #{delete := true}}, _QoS}, Acc) ->
|
||||
Key = {Topic, maps:without([delete], Opts)},
|
||||
lists:keydelete(Key, 1, Acc);
|
||||
fun({{Topic, Opts = #{deny_subscription := true}}, _ReturnCode}, Acc) ->
|
||||
Key = {Topic, maps:without([deny_subscription], Opts)},
|
||||
lists:keyreplace(Key, 1, Acc, {Key, ?RC_UNSPECIFIED_ERROR});
|
||||
(Tuple = {Key, _Value}, Acc) ->
|
||||
lists:keyreplace(Key, 1, Acc, Tuple)
|
||||
end,
|
||||
|
|
|
@ -625,7 +625,7 @@ t_handle_in_empty_client_subscribe_hook({'end', _Config}) ->
|
|||
ok;
|
||||
t_handle_in_empty_client_subscribe_hook(Config) when is_list(Config) ->
|
||||
Hook = fun(_ClientInfo, _Username, TopicFilter) ->
|
||||
EmptyFilters = [{T, Opts#{delete => true}} || {T, Opts} <- TopicFilter],
|
||||
EmptyFilters = [{T, Opts#{deny_subscription => true}} || {T, Opts} <- TopicFilter],
|
||||
{stop, EmptyFilters}
|
||||
end,
|
||||
ok = emqx:hook('client.subscribe', Hook, []),
|
||||
|
@ -633,7 +633,7 @@ t_handle_in_empty_client_subscribe_hook(Config) when is_list(Config) ->
|
|||
{ok, C} = emqtt:start_link(),
|
||||
{ok, _} = emqtt:connect(C),
|
||||
{ok, _, RCs} = emqtt:subscribe(C, <<"t">>),
|
||||
?assertEqual([], RCs),
|
||||
?assertEqual([?RC_UNSPECIFIED_ERROR], RCs),
|
||||
ok
|
||||
after
|
||||
ok = emqx:unhook('client.subscribe', Hook)
|
||||
|
|
Loading…
Reference in New Issue