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

mod_push_keepalive: Don't let hook crash

Check whether mod_push_keepalive is loaded for a given host before
querying the module configuration for that host.  This avoids a hook
crash in the case where the module is enabled for some but not all
hosts.
This commit is contained in:
Holger Weiss 2023-08-09 00:11:43 +02:00
parent 26ed6539ba
commit f0db7623d1

View File

@ -234,8 +234,11 @@ c2s_handle_info(State, _) ->
-spec ejabberd_started() -> ok.
ejabberd_started() ->
[wake_all(Host) || Host <- ejabberd_config:get_option(hosts),
mod_push_keepalive_opt:wake_on_start(Host)],
Pred = fun(Host) ->
gen_mod:is_loaded(Host, ?MODULE) andalso
mod_push_keepalive_opt:wake_on_start(Host)
end,
[wake_all(Host) || Host <- ejabberd_config:get_option(hosts), Pred(Host)],
ok.
%%--------------------------------------------------------------------