This commit is contained in:
Feng 2015-12-17 14:12:45 +08:00
parent 7ffa25c655
commit be390d42ac
1 changed files with 7 additions and 1 deletions

View File

@ -31,7 +31,7 @@
-define(SERVER, ?MODULE). -define(SERVER, ?MODULE).
-export([start_link/0]). -export([start_link/0, stop/0]).
%% statistics API. %% statistics API.
-export([statsfun/1, statsfun/2, -export([statsfun/1, statsfun/2,
@ -88,6 +88,9 @@
start_link() -> start_link() ->
gen_server:start_link({local, ?SERVER}, ?MODULE, [], []). gen_server:start_link({local, ?SERVER}, ?MODULE, [], []).
stop() ->
gen_server:call(?SERVER, stop).
%%------------------------------------------------------------------------------ %%------------------------------------------------------------------------------
%% @doc Generate stats fun %% @doc Generate stats fun
%% @end %% @end
@ -149,6 +152,9 @@ init([]) ->
% Tick to publish stats % Tick to publish stats
{ok, #state{tick_tref = emqttd_broker:start_tick(tick)}, hibernate}. {ok, #state{tick_tref = emqttd_broker:start_tick(tick)}, hibernate}.
handle_call(stop, _From, State) ->
{stop, normal, ok, State};
handle_call(_Request, _From, State) -> handle_call(_Request, _From, State) ->
{reply, error, State}. {reply, error, State}.