Merge branch 'master' into dev
This commit is contained in:
commit
04e4205444
|
@ -75,7 +75,7 @@ cd emqttd && make && make dist
|
||||||
|
|
||||||
## GetStarted
|
## GetStarted
|
||||||
|
|
||||||
Read [emqtt wiki](https://github.com/emqtt/emqttd/wiki) for detaied installation and configuration guide.
|
Read [emqtt wiki](https://github.com/emqtt/emqttd/wiki) for detailed installation and configuration guide.
|
||||||
|
|
||||||
|
|
||||||
## Benchmark
|
## Benchmark
|
||||||
|
|
|
@ -162,7 +162,7 @@ loaded_plugins() ->
|
||||||
-spec unload_all_plugins() -> [{App :: atom(), ok | {error, any()}}].
|
-spec unload_all_plugins() -> [{App :: atom(), ok | {error, any()}}].
|
||||||
unload_all_plugins() ->
|
unload_all_plugins() ->
|
||||||
PluginApps = application:get_env(emqttd, plugins, []),
|
PluginApps = application:get_env(emqttd, plugins, []),
|
||||||
[{App, unload_plugin(App)} || {App, _Env} <- PluginApps].
|
[{App, unload_plugin(App)} || App <- PluginApps].
|
||||||
|
|
||||||
|
|
||||||
%%------------------------------------------------------------------------------
|
%%------------------------------------------------------------------------------
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
-behaviour(application).
|
-behaviour(application).
|
||||||
|
|
||||||
%% Application callbacks
|
%% Application callbacks
|
||||||
-export([start/2, stop/1]).
|
-export([start/2, prep_stop/1, stop/1]).
|
||||||
|
|
||||||
-define(PRINT_MSG(Msg), io:format(Msg)).
|
-define(PRINT_MSG(Msg), io:format(Msg)).
|
||||||
|
|
||||||
|
@ -128,10 +128,16 @@ worker_spec(Name, Opts) ->
|
||||||
{Name, start_link, [Opts]},
|
{Name, start_link, [Opts]},
|
||||||
permanent, 10000, worker, [Name]}.
|
permanent, 10000, worker, [Name]}.
|
||||||
|
|
||||||
-spec stop(State :: term()) -> term().
|
%% close all listeners first...
|
||||||
stop(_State) ->
|
prep_stop(State) ->
|
||||||
|
%%TODO: esockd app should be running...
|
||||||
{ok, Listeners} = application:get_env(listeners),
|
{ok, Listeners} = application:get_env(listeners),
|
||||||
emqttd:close_listeners(Listeners),
|
emqttd:close_listeners(Listeners),
|
||||||
emqttd:unload_all_plugins(),
|
timer:sleep(2),
|
||||||
|
State.
|
||||||
|
|
||||||
|
-spec stop(State :: term()) -> term().
|
||||||
|
stop(_State) ->
|
||||||
ok.
|
ok.
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -75,12 +75,21 @@ cluster([SNode]) ->
|
||||||
Node = node_name(SNode),
|
Node = node_name(SNode),
|
||||||
case net_adm:ping(Node) of
|
case net_adm:ping(Node) of
|
||||||
pong ->
|
pong ->
|
||||||
|
case emqttd:is_running(Node) of
|
||||||
|
true ->
|
||||||
|
%%TODO: should not unload here.
|
||||||
|
emqttd:unload_all_plugins(),
|
||||||
application:stop(emqttd),
|
application:stop(emqttd),
|
||||||
application:stop(esockd),
|
application:stop(esockd),
|
||||||
|
application:stop(gproc),
|
||||||
emqttd_mnesia:cluster(Node),
|
emqttd_mnesia:cluster(Node),
|
||||||
|
application:start(gproc),
|
||||||
application:start(esockd),
|
application:start(esockd),
|
||||||
application:start(emqttd),
|
application:start(emqttd),
|
||||||
?PRINT("cluster with ~p successfully.~n", [Node]);
|
?PRINT("cluster with ~p successfully.~n", [Node]);
|
||||||
|
false ->
|
||||||
|
?PRINT("emqttd is not running on ~p~n", [Node])
|
||||||
|
end;
|
||||||
pang ->
|
pang ->
|
||||||
?PRINT("failed to connect to ~p~n", [Node])
|
?PRINT("failed to connect to ~p~n", [Node])
|
||||||
end.
|
end.
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
%%%-----------------------------------------------------------------------------
|
%%%-----------------------------------------------------------------------------
|
||||||
%%
|
%%
|
||||||
%% [ACL Design](https://github.com/emqtt/emqttd/wiki/ACL-Design)
|
%% [ACL](https://github.com/emqtt/emqttd/wiki/ACL)
|
||||||
%%
|
%%
|
||||||
%% -type who() :: all | binary() |
|
%% -type who() :: all | binary() |
|
||||||
%% {ipaddr, esockd_access:cidr()} |
|
%% {ipaddr, esockd_access:cidr()} |
|
||||||
|
|
Loading…
Reference in New Issue