diff options
author | Evgeniy Khramtsov <ekhramtsov@process-one.net> | 2017-04-30 19:01:47 +0300 |
---|---|---|
committer | Evgeniy Khramtsov <ekhramtsov@process-one.net> | 2017-04-30 19:01:47 +0300 |
commit | fddd6110e00df12c99a20a2cc9d074f5f4f1f965 (patch) | |
tree | 366575b855f1b2013db7eeb02ecb213f81c98c1f /src/mod_bosh.erl | |
parent | Merge branch 'new-option-validation' (diff) |
Don't validate an option in gen_mod:get*opt() functions
The changes are very similar to those from previous commit:
* Now there is no need to pass validating function in
gen_mod:get_opt() and gen_mod:get_module_opt() functions,
because the modules' configuration keeps already validated values.
* New functions gen_mod:get_opt/2 and gen_mod:get_module_opt/3 are
introduced.
* Functions gen_mod:get_opt/4 and get_module_opt/5 are deprecated.
If the functions are still called, the "function" argument is
simply ignored.
* Validating callback Mod:listen_opt_type/1 is introduced to validate
listening options at startup.
Diffstat (limited to 'src/mod_bosh.erl')
-rw-r--r-- | src/mod_bosh.erl | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/src/mod_bosh.erl b/src/mod_bosh.erl index c2bf7600..ed12d569 100644 --- a/src/mod_bosh.erl +++ b/src/mod_bosh.erl @@ -144,10 +144,7 @@ reload(_Host, NewOpts, _OldOpts) -> %%% Internal functions %%%=================================================================== start_jiffy(Opts) -> - case gen_mod:get_opt(json, Opts, - fun(false) -> false; - (true) -> true - end, false) of + case gen_mod:get_opt(json, Opts, false) of false -> ok; true -> @@ -220,7 +217,7 @@ use_cache(Mod) -> true -> Mod:use_cache(); false -> gen_mod:get_module_opt( - global, ?MODULE, use_cache, mod_opt_type(use_cache), + global, ?MODULE, use_cache, ejabberd_config:use_cache(global)) end. @@ -244,15 +241,12 @@ delete_cache(Mod, SID) -> cache_opts() -> MaxSize = gen_mod:get_module_opt( global, ?MODULE, cache_size, - mod_opt_type(cache_size), ejabberd_config:cache_size(global)), CacheMissed = gen_mod:get_module_opt( global, ?MODULE, cache_missed, - mod_opt_type(cache_missed), ejabberd_config:cache_missed(global)), LifeTime = case gen_mod:get_module_opt( global, ?MODULE, cache_life_time, - mod_opt_type(cache_life_time), ejabberd_config:cache_life_time(global)) of infinity -> infinity; I -> timer:seconds(I) |