Merge pull request #6077 from zmstone/sync-exproto-code
Sync exproto code from ee to ce
This commit is contained in:
commit
6b06142562
|
@ -1,5 +1,5 @@
|
||||||
{deps,
|
{deps,
|
||||||
[{epgsql, {git, "https://github.com/epgsql/epgsql", {tag, "4.4.0"}}}
|
[{epgsql, {git, "https://github.com/epgsql/epgsql.git", {tag, "4.4.0"}}}
|
||||||
]}.
|
]}.
|
||||||
|
|
||||||
{erl_opts, [warn_unused_vars,
|
{erl_opts, [warn_unused_vars,
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{application, emqx_exproto,
|
{application, emqx_exproto,
|
||||||
[{description, "EMQ X Extension for Protocol"},
|
[{description, "EMQ X Extension for Protocol"},
|
||||||
{vsn, "4.3.2"}, %% strict semver
|
{vsn, "4.3.4"}, %% 4.3.3 is used by ee
|
||||||
{modules, []},
|
{modules, []},
|
||||||
{registered, []},
|
{registered, []},
|
||||||
{mod, {emqx_exproto_app, []}},
|
{mod, {emqx_exproto_app, []}},
|
||||||
|
|
|
@ -1,31 +1,26 @@
|
||||||
%% -*-: erlang -*-
|
%% -*- mode: erlang -*-
|
||||||
{VSN,
|
{VSN,
|
||||||
[
|
[{"4.3.3",
|
||||||
{"4.3.1", [
|
[{load_module,emqx_exproto_conn,brutal_purge,soft_purge,[]},
|
||||||
{load_module, emqx_exproto_gsvr, brutal_purge, soft_purge, []},
|
{load_module,emqx_exproto_channel,brutal_purge,soft_purge,[]}]},
|
||||||
{load_module, emqx_exproto_gcli, brutal_purge, soft_purge, []},
|
{"4.3.2",
|
||||||
{load_module, emqx_exproto_channel, brutal_purge, soft_purge, []}
|
[{load_module,emqx_exproto_conn,brutal_purge,soft_purge,[]},
|
||||||
]},
|
{load_module,emqx_exproto_channel,brutal_purge,soft_purge,[]}]},
|
||||||
{"4.3.0", [
|
{<<"4.3.[0-1]">>,
|
||||||
{load_module, emqx_exproto_gsvr, brutal_purge, soft_purge, []},
|
[{load_module,emqx_exproto_gsvr,brutal_purge,soft_purge,[]},
|
||||||
{load_module,emqx_exproto_gcli,brutal_purge,soft_purge,[]},
|
{load_module,emqx_exproto_gcli,brutal_purge,soft_purge,[]},
|
||||||
{load_module,emqx_exproto_conn,brutal_purge,soft_purge,[]},
|
{load_module,emqx_exproto_conn,brutal_purge,soft_purge,[]},
|
||||||
{load_module, emqx_exproto_channel, brutal_purge, soft_purge, []}
|
{load_module,emqx_exproto_channel,brutal_purge,soft_purge,[]}]},
|
||||||
]},
|
{<<".*">>,[]}],
|
||||||
{<<".*">>, []}
|
[{"4.3.3",
|
||||||
],
|
[{load_module,emqx_exproto_conn,brutal_purge,soft_purge,[]},
|
||||||
[
|
{load_module,emqx_exproto_channel,brutal_purge,soft_purge,[]}]},
|
||||||
{"4.3.1", [
|
{"4.3.2",
|
||||||
{load_module, emqx_exproto_gsvr, brutal_purge, soft_purge, []},
|
[{load_module,emqx_exproto_conn,brutal_purge,soft_purge,[]},
|
||||||
{load_module, emqx_exproto_gcli, brutal_purge, soft_purge, []},
|
{load_module,emqx_exproto_channel,brutal_purge,soft_purge,[]}]},
|
||||||
{load_module, emqx_exproto_channel, brutal_purge, soft_purge, []}
|
{<<"4.3.[0-1]">>,
|
||||||
]},
|
[{load_module,emqx_exproto_gsvr,brutal_purge,soft_purge,[]},
|
||||||
{"4.3.0", [
|
|
||||||
{load_module, emqx_exproto_gsvr, brutal_purge, soft_purge, []},
|
|
||||||
{load_module,emqx_exproto_gcli,brutal_purge,soft_purge,[]},
|
{load_module,emqx_exproto_gcli,brutal_purge,soft_purge,[]},
|
||||||
{load_module,emqx_exproto_conn,brutal_purge,soft_purge,[]},
|
{load_module,emqx_exproto_conn,brutal_purge,soft_purge,[]},
|
||||||
{load_module, emqx_exproto_channel, brutal_purge, soft_purge, []}
|
{load_module,emqx_exproto_channel,brutal_purge,soft_purge,[]}]},
|
||||||
]},
|
{<<".*">>,[]}]}.
|
||||||
{<<".*">>, []}
|
|
||||||
]
|
|
||||||
}.
|
|
||||||
|
|
|
@ -94,6 +94,9 @@
|
||||||
awaiting_rel_max
|
awaiting_rel_max
|
||||||
]).
|
]).
|
||||||
|
|
||||||
|
-define(CHANMOCK(P), {exproto_anonymous_client, P}).
|
||||||
|
-define(CHAN_CONN_TAB, emqx_channel_conn).
|
||||||
|
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
%% Info, Attrs and Caps
|
%% Info, Attrs and Caps
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
|
@ -155,13 +158,19 @@ init(ConnInfo = #{socktype := Socktype,
|
||||||
conn_state = connecting,
|
conn_state = connecting,
|
||||||
timers = #{}
|
timers = #{}
|
||||||
},
|
},
|
||||||
|
case emqx_hooks:run_fold('client.connect', [NConnInfo], #{}) of
|
||||||
|
{error, _Reason} ->
|
||||||
|
throw(nopermission);
|
||||||
|
_ ->
|
||||||
|
ConnMod = maps:get(conn_mod, NConnInfo),
|
||||||
|
true = ets:insert(?CHAN_CONN_TAB, {?CHANMOCK(self()), ConnMod}),
|
||||||
Req = #{conninfo =>
|
Req = #{conninfo =>
|
||||||
peercert(Peercert,
|
peercert(Peercert,
|
||||||
#{socktype => socktype(Socktype),
|
#{socktype => socktype(Socktype),
|
||||||
peername => address(Peername),
|
peername => address(Peername),
|
||||||
sockname => address(Sockname)})},
|
sockname => address(Sockname)})},
|
||||||
try_dispatch(on_socket_created, wrap(Req), Channel).
|
try_dispatch(on_socket_created, wrap(Req), Channel)
|
||||||
|
end.
|
||||||
|
|
||||||
%% @private
|
%% @private
|
||||||
peercert(NoSsl, ConnInfo) when NoSsl == nossl;
|
peercert(NoSsl, ConnInfo) when NoSsl == nossl;
|
||||||
|
@ -283,6 +292,7 @@ handle_call({auth, ClientInfo0, Password},
|
||||||
emqx_metrics:inc('client.auth.anonymous'),
|
emqx_metrics:inc('client.auth.anonymous'),
|
||||||
NClientInfo = maps:merge(ClientInfo1, AuthResult),
|
NClientInfo = maps:merge(ClientInfo1, AuthResult),
|
||||||
NChannel = Channel1#channel{clientinfo = NClientInfo},
|
NChannel = Channel1#channel{clientinfo = NClientInfo},
|
||||||
|
clean_anonymous_clients(),
|
||||||
case emqx_cm:open_session(true, NClientInfo, NConnInfo) of
|
case emqx_cm:open_session(true, NClientInfo, NConnInfo) of
|
||||||
{ok, _Session} ->
|
{ok, _Session} ->
|
||||||
?LOG(debug, "Client ~s (Username: '~s') authorized successfully!",
|
?LOG(debug, "Client ~s (Username: '~s') authorized successfully!",
|
||||||
|
@ -399,12 +409,16 @@ handle_info(Info, Channel) ->
|
||||||
|
|
||||||
-spec(terminate(any(), channel()) -> channel()).
|
-spec(terminate(any(), channel()) -> channel()).
|
||||||
terminate(Reason, Channel) ->
|
terminate(Reason, Channel) ->
|
||||||
|
clean_anonymous_clients(),
|
||||||
Req = #{reason => stringfy(Reason)},
|
Req = #{reason => stringfy(Reason)},
|
||||||
try_dispatch(on_socket_closed, wrap(Req), Channel).
|
try_dispatch(on_socket_closed, wrap(Req), Channel).
|
||||||
|
|
||||||
is_anonymous(#{anonymous := true}) -> true;
|
is_anonymous(#{anonymous := true}) -> true;
|
||||||
is_anonymous(_AuthResult) -> false.
|
is_anonymous(_AuthResult) -> false.
|
||||||
|
|
||||||
|
clean_anonymous_clients() ->
|
||||||
|
ets:delete(?CHAN_CONN_TAB, ?CHANMOCK(self())).
|
||||||
|
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
%% Sub/UnSub
|
%% Sub/UnSub
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
|
@ -577,7 +591,6 @@ default_conninfo(ConnInfo) ->
|
||||||
ConnInfo#{clean_start => true,
|
ConnInfo#{clean_start => true,
|
||||||
clientid => undefined,
|
clientid => undefined,
|
||||||
username => undefined,
|
username => undefined,
|
||||||
conn_mod => undefined,
|
|
||||||
conn_props => #{},
|
conn_props => #{},
|
||||||
connected => true,
|
connected => true,
|
||||||
connected_at => erlang:system_time(millisecond),
|
connected_at => erlang:system_time(millisecond),
|
||||||
|
|
|
@ -233,7 +233,11 @@ init(Parent, WrappedSock, Peername0, Options) ->
|
||||||
case esockd_wait(WrappedSock) of
|
case esockd_wait(WrappedSock) of
|
||||||
{ok, NWrappedSock} ->
|
{ok, NWrappedSock} ->
|
||||||
Peername = esockd_peername(NWrappedSock, Peername0),
|
Peername = esockd_peername(NWrappedSock, Peername0),
|
||||||
run_loop(Parent, init_state(NWrappedSock, Peername, Options));
|
try
|
||||||
|
run_loop(Parent, init_state(NWrappedSock, Peername, Options))
|
||||||
|
catch
|
||||||
|
throw : nopermission -> erlang:exit(normal)
|
||||||
|
end;
|
||||||
{error, Reason} ->
|
{error, Reason} ->
|
||||||
ok = esockd_close(WrappedSock),
|
ok = esockd_close(WrappedSock),
|
||||||
exit_on_sock_error(Reason)
|
exit_on_sock_error(Reason)
|
||||||
|
@ -601,9 +605,9 @@ handle_outgoing(IoData, State = #state{socket = Socket}) ->
|
||||||
handle_info(activate_socket, State = #state{sockstate = OldSst}) ->
|
handle_info(activate_socket, State = #state{sockstate = OldSst}) ->
|
||||||
case activate_socket(State) of
|
case activate_socket(State) of
|
||||||
{ok, NState = #state{sockstate = NewSst}} ->
|
{ok, NState = #state{sockstate = NewSst}} ->
|
||||||
if OldSst =/= NewSst ->
|
case OldSst =/= NewSst of
|
||||||
{ok, {event, NewSst}, NState};
|
true -> {ok, {event, NewSst}, NState};
|
||||||
true -> {ok, NState}
|
false -> {ok, NState}
|
||||||
end;
|
end;
|
||||||
{error, Reason} ->
|
{error, Reason} ->
|
||||||
handle_info({sock_error, Reason}, State)
|
handle_info({sock_error, Reason}, State)
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{application, emqx_rule_engine,
|
{application, emqx_rule_engine,
|
||||||
[{description, "EMQ X Rule Engine"},
|
[{description, "EMQ X Rule Engine"},
|
||||||
{vsn, "4.3.5"}, % strict semver, bump manually!
|
{vsn, "4.3.6"}, % strict semver, bump manually!
|
||||||
{modules, []},
|
{modules, []},
|
||||||
{registered, [emqx_rule_engine_sup, emqx_rule_registry]},
|
{registered, [emqx_rule_engine_sup, emqx_rule_registry]},
|
||||||
{applications, [kernel,stdlib,rulesql,getopt]},
|
{applications, [kernel,stdlib,rulesql,getopt]},
|
||||||
|
|
|
@ -1,64 +1,52 @@
|
||||||
%% -*-: erlang -*-
|
%% -*- mode: erlang -*-
|
||||||
{"4.3.5",
|
{VSN,
|
||||||
[ {"4.3.0",
|
[{"4.3.5",[{load_module,emqx_rule_registry,brutal_purge,soft_purge,[]}]},
|
||||||
[ {load_module, emqx_rule_funcs, brutal_purge, soft_purge, []}
|
|
||||||
, {load_module, emqx_rule_engine, brutal_purge, soft_purge, []}
|
|
||||||
, {load_module, emqx_rule_registry, brutal_purge, soft_purge, []}
|
|
||||||
, {apply, {emqx_stats, cancel_update, [rule_registery_stats]}}
|
|
||||||
, {load_module, emqx_rule_actions, brutal_purge, soft_purge, []}
|
|
||||||
]},
|
|
||||||
{"4.3.1",
|
|
||||||
[ {load_module, emqx_rule_engine, brutal_purge, soft_purge, []}
|
|
||||||
, {load_module, emqx_rule_registry, brutal_purge, soft_purge, []}
|
|
||||||
, {apply, {emqx_stats, cancel_update, [rule_registery_stats]}}
|
|
||||||
, {load_module, emqx_rule_actions, brutal_purge, soft_purge, []}
|
|
||||||
]},
|
|
||||||
{"4.3.2",
|
|
||||||
[ {load_module, emqx_rule_registry, brutal_purge, soft_purge, []}
|
|
||||||
, {apply, {emqx_stats, cancel_update, [rule_registery_stats]}}
|
|
||||||
, {load_module, emqx_rule_engine, brutal_purge, soft_purge, []}
|
|
||||||
, {load_module, emqx_rule_actions, brutal_purge, soft_purge, []}
|
|
||||||
]},
|
|
||||||
{"4.3.3",
|
|
||||||
[ {load_module, emqx_rule_engine, brutal_purge, soft_purge, []}
|
|
||||||
, {load_module, emqx_rule_actions, brutal_purge, soft_purge, []}
|
|
||||||
, {load_module, emqx_rule_registry, brutal_purge, soft_purge, []}
|
|
||||||
]},
|
|
||||||
{"4.3.4",
|
|
||||||
[ {load_module, emqx_rule_engine, brutal_purge, soft_purge, []}
|
|
||||||
, {load_module, emqx_rule_registry, brutal_purge, soft_purge, []}
|
|
||||||
]},
|
|
||||||
{<<".*">>, []}
|
|
||||||
],
|
|
||||||
[
|
|
||||||
{"4.3.0",
|
{"4.3.0",
|
||||||
[ {load_module, emqx_rule_funcs, brutal_purge, soft_purge, []}
|
[{load_module,emqx_rule_funcs,brutal_purge,soft_purge,[]},
|
||||||
, {load_module, emqx_rule_engine, brutal_purge, soft_purge, []}
|
{load_module,emqx_rule_engine,brutal_purge,soft_purge,[]},
|
||||||
, {load_module, emqx_rule_registry, brutal_purge, soft_purge, []}
|
{load_module,emqx_rule_registry,brutal_purge,soft_purge,[]},
|
||||||
, {apply, {emqx_stats, cancel_update, [rule_registery_stats]}}
|
{apply,{emqx_stats,cancel_update,[rule_registery_stats]}},
|
||||||
, {load_module, emqx_rule_actions, brutal_purge, soft_purge, []}
|
{load_module,emqx_rule_actions,brutal_purge,soft_purge,[]}]},
|
||||||
]},
|
|
||||||
{"4.3.1",
|
{"4.3.1",
|
||||||
[ {load_module, emqx_rule_engine, brutal_purge, soft_purge, []}
|
[{load_module,emqx_rule_engine,brutal_purge,soft_purge,[]},
|
||||||
, {load_module, emqx_rule_registry, brutal_purge, soft_purge, []}
|
{load_module,emqx_rule_registry,brutal_purge,soft_purge,[]},
|
||||||
, {apply, {emqx_stats, cancel_update, [rule_registery_stats]}}
|
{apply,{emqx_stats,cancel_update,[rule_registery_stats]}},
|
||||||
, {load_module, emqx_rule_actions, brutal_purge, soft_purge, []}
|
{load_module,emqx_rule_actions,brutal_purge,soft_purge,[]}]},
|
||||||
]},
|
|
||||||
{"4.3.2",
|
{"4.3.2",
|
||||||
[ {load_module, emqx_rule_registry, brutal_purge, soft_purge, []}
|
[{load_module,emqx_rule_registry,brutal_purge,soft_purge,[]},
|
||||||
, {apply, {emqx_stats, cancel_update, [rule_registery_stats]}}
|
{apply,{emqx_stats,cancel_update,[rule_registery_stats]}},
|
||||||
, {load_module, emqx_rule_engine, brutal_purge, soft_purge, []}
|
{load_module,emqx_rule_engine,brutal_purge,soft_purge,[]},
|
||||||
, {load_module, emqx_rule_actions, brutal_purge, soft_purge, []}
|
{load_module,emqx_rule_actions,brutal_purge,soft_purge,[]}]},
|
||||||
]},
|
|
||||||
{"4.3.3",
|
{"4.3.3",
|
||||||
[ {load_module, emqx_rule_engine, brutal_purge, soft_purge, []}
|
[{load_module,emqx_rule_engine,brutal_purge,soft_purge,[]},
|
||||||
, {load_module, emqx_rule_actions, brutal_purge, soft_purge, []}
|
{load_module,emqx_rule_actions,brutal_purge,soft_purge,[]},
|
||||||
, {load_module, emqx_rule_registry, brutal_purge, soft_purge, []}
|
{load_module,emqx_rule_registry,brutal_purge,soft_purge,[]}]},
|
||||||
]},
|
|
||||||
{"4.3.4",
|
{"4.3.4",
|
||||||
[ {load_module, emqx_rule_engine, brutal_purge, soft_purge, []}
|
[{load_module,emqx_rule_engine,brutal_purge,soft_purge,[]},
|
||||||
, {load_module, emqx_rule_registry, brutal_purge, soft_purge, []}
|
{load_module,emqx_rule_registry,brutal_purge,soft_purge,[]}]},
|
||||||
]},
|
{<<".*">>,[]}],
|
||||||
{<<".*">>, []}
|
[{"4.3.5",[{load_module,emqx_rule_registry,brutal_purge,soft_purge,[]}]},
|
||||||
]
|
{"4.3.0",
|
||||||
}.
|
[{load_module,emqx_rule_funcs,brutal_purge,soft_purge,[]},
|
||||||
|
{load_module,emqx_rule_engine,brutal_purge,soft_purge,[]},
|
||||||
|
{load_module,emqx_rule_registry,brutal_purge,soft_purge,[]},
|
||||||
|
{apply,{emqx_stats,cancel_update,[rule_registery_stats]}},
|
||||||
|
{load_module,emqx_rule_actions,brutal_purge,soft_purge,[]}]},
|
||||||
|
{"4.3.1",
|
||||||
|
[{load_module,emqx_rule_engine,brutal_purge,soft_purge,[]},
|
||||||
|
{load_module,emqx_rule_registry,brutal_purge,soft_purge,[]},
|
||||||
|
{apply,{emqx_stats,cancel_update,[rule_registery_stats]}},
|
||||||
|
{load_module,emqx_rule_actions,brutal_purge,soft_purge,[]}]},
|
||||||
|
{"4.3.2",
|
||||||
|
[{load_module,emqx_rule_registry,brutal_purge,soft_purge,[]},
|
||||||
|
{apply,{emqx_stats,cancel_update,[rule_registery_stats]}},
|
||||||
|
{load_module,emqx_rule_engine,brutal_purge,soft_purge,[]},
|
||||||
|
{load_module,emqx_rule_actions,brutal_purge,soft_purge,[]}]},
|
||||||
|
{"4.3.3",
|
||||||
|
[{load_module,emqx_rule_engine,brutal_purge,soft_purge,[]},
|
||||||
|
{load_module,emqx_rule_actions,brutal_purge,soft_purge,[]},
|
||||||
|
{load_module,emqx_rule_registry,brutal_purge,soft_purge,[]}]},
|
||||||
|
{"4.3.4",
|
||||||
|
[{load_module,emqx_rule_engine,brutal_purge,soft_purge,[]},
|
||||||
|
{load_module,emqx_rule_registry,brutal_purge,soft_purge,[]}]},
|
||||||
|
{<<".*">>,[]}]}.
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{application, emqx_stomp,
|
{application, emqx_stomp,
|
||||||
[{description, "EMQ X Stomp Protocol Plugin"},
|
[{description, "EMQ X Stomp Protocol Plugin"},
|
||||||
{vsn, "4.3.1"}, % strict semver, bump manually!
|
{vsn, "4.3.2"}, % strict semver, bump manually!
|
||||||
{modules, []},
|
{modules, []},
|
||||||
{registered, [emqx_stomp_sup]},
|
{registered, [emqx_stomp_sup]},
|
||||||
{applications, [kernel,stdlib]},
|
{applications, [kernel,stdlib]},
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
%% -*- mode: erlang -*-
|
%% -*- mode: erlang -*-
|
||||||
{"4.3.1",
|
{VSN,
|
||||||
[{"4.3.0",
|
[{"4.3.1",[{load_module,emqx_stomp_connection,brutal_purge,soft_purge,[]}]},
|
||||||
|
{"4.3.0",
|
||||||
[{restart_application,emqx_stomp}]},
|
[{restart_application,emqx_stomp}]},
|
||||||
{<<".*">>,[]}],
|
{<<".*">>,[]}],
|
||||||
[{"4.3.0",
|
[{"4.3.1",[{load_module,emqx_stomp_connection,brutal_purge,soft_purge,[]}]},
|
||||||
|
{"4.3.0",
|
||||||
[{restart_application,emqx_stomp}]},
|
[{restart_application,emqx_stomp}]},
|
||||||
{<<".*">>,[]}]}.
|
{<<".*">>,[]}]}.
|
||||||
|
|
|
@ -91,6 +91,8 @@
|
||||||
|
|
||||||
-define(ENABLED(X), (X =/= undefined)).
|
-define(ENABLED(X), (X =/= undefined)).
|
||||||
|
|
||||||
|
-elvis([{elvis_style, invalid_dynamic_call, #{ignore => [emqx_stomp_connection]}}]).
|
||||||
|
|
||||||
-dialyzer({nowarn_function, [ ensure_stats_timer/2
|
-dialyzer({nowarn_function, [ ensure_stats_timer/2
|
||||||
]}).
|
]}).
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{application, emqx_dashboard,
|
{application, emqx_dashboard,
|
||||||
[{description, "EMQ X Web Dashboard"},
|
[{description, "EMQ X Web Dashboard"},
|
||||||
{vsn, "4.3.5"}, % strict semver, bump manually!
|
{vsn, "4.3.6"}, % strict semver, bump manually!
|
||||||
{modules, []},
|
{modules, []},
|
||||||
{registered, [emqx_dashboard_sup]},
|
{registered, [emqx_dashboard_sup]},
|
||||||
{applications, [kernel,stdlib,mnesia,minirest]},
|
{applications, [kernel,stdlib,mnesia,minirest]},
|
||||||
|
|
Loading…
Reference in New Issue