25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-20 16:15:59 +01:00

Do not try to start ezlib application too frequently

This may overload Erlang applicaton controller
This commit is contained in:
Evgeniy Khramtsov 2018-01-16 18:06:31 +03:00
parent d35a8805b0
commit c0ef054f6f
2 changed files with 9 additions and 1 deletions

View File

@ -576,6 +576,7 @@ transform_options(Opt, Opts) ->
validate_module_options(Module, Opts) ->
try Module:listen_opt_type('') of
_ ->
maybe_start_zlib(Opts),
lists:filtermap(
fun({Opt, Val}) ->
case validate_module_option(Module, Opt, Val) of
@ -664,5 +665,13 @@ all_zero_ip(Opts) ->
false -> {0,0,0,0}
end.
maybe_start_zlib(Opts) ->
case proplists:get_bool(zlib, Opts) of
true ->
ejabberd:start_app(ezlib);
false ->
ok
end.
opt_type(listen) -> fun validate_cfg/1;
opt_type(_) -> [listen].

View File

@ -166,7 +166,6 @@ compress(SocketData) -> compress(SocketData, undefined).
compress(#socket_state{receiver = undefined,
sockmod = SockMod,
socket = Socket} = SocketData, Data) ->
ejabberd:start_app(ezlib),
{ok, ZlibSocket} = ezlib:enable_zlib(SockMod, Socket),
case Data of
undefined -> ok;