Skip to content

Commit

Permalink
mod_push_keepalive: Don't let hook crash
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
weiss committed Aug 8, 2023
1 parent 26ed653 commit f0db762
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/mod_push_keepalive.erl
Original file line number Diff line number Diff line change
Expand Up @@ -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.

%%--------------------------------------------------------------------
Expand Down

0 comments on commit f0db762

Please sign in to comment.