25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-12-22 17:28:25 +01:00

mod_http_fileserver: Unregister 'reopen_log_hook'

Unregister the global 'reopen_log_hook' on termination if the module isn't
loaded for another host.
This commit is contained in:
Holger Weiss 2019-07-14 15:16:13 +02:00
parent 15dcff92e8
commit cd36bb6eda

View File

@ -243,11 +243,14 @@ handle_info(Info, State) ->
%% cleaning up. When it returns, the gen_server terminates with Reason. %% cleaning up. When it returns, the gen_server terminates with Reason.
%% The return value is ignored. %% The return value is ignored.
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
terminate(_Reason, State) -> terminate(_Reason, #state{host = Host} = State) ->
close_log(State#state.accesslogfd), close_log(State#state.accesslogfd),
%% TODO: unregister the hook gracefully case gen_mod:is_loaded_elsewhere(Host, ?MODULE) of
%% ejabberd_hooks:delete(reopen_log_hook, State#state.host, ?MODULE, reopen_log, 50), false ->
ok. ejabberd_hooks:delete(reopen_log_hook, ?MODULE, reopen_log, 50);
true ->
ok
end.
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
%% Func: code_change(OldVsn, State, Extra) -> {ok, NewState} %% Func: code_change(OldVsn, State, Extra) -> {ok, NewState}