prep_stop to close listeners
This commit is contained in:
parent
118dc34e5e
commit
14421dae5b
|
@ -31,7 +31,7 @@
|
|||
-behaviour(application).
|
||||
|
||||
%% Application callbacks
|
||||
-export([start/2, stop/1]).
|
||||
-export([start/2, prep_stop/1, stop/1]).
|
||||
|
||||
-define(PRINT_MSG(Msg), io:format(Msg)).
|
||||
|
||||
|
@ -128,10 +128,16 @@ worker_spec(Name, Opts) ->
|
|||
{Name, start_link, [Opts]},
|
||||
permanent, 10000, worker, [Name]}.
|
||||
|
||||
-spec stop(State :: term()) -> term().
|
||||
stop(_State) ->
|
||||
%% close all listeners first...
|
||||
prep_stop(State) ->
|
||||
%%TODO: esockd app should be running...
|
||||
{ok, Listeners} = application:get_env(listeners),
|
||||
emqttd:close_listeners(Listeners),
|
||||
emqttd:unload_all_plugins(),
|
||||
timer:sleep(2),
|
||||
State.
|
||||
|
||||
-spec stop(State :: term()) -> term().
|
||||
stop(_State) ->
|
||||
ok.
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue