diff --git a/src/mod_carboncopy.erl b/src/mod_carboncopy.erl index 1e7d2814a16..54a6320cbe9 100644 --- a/src/mod_carboncopy.erl +++ b/src/mod_carboncopy.erl @@ -74,9 +74,9 @@ is_carbon_copy(Packet) -> _ -> false end. -start(HostType, Opts) -> - %% execute disable/enable actions in the c2s process itself - IQDisc = gen_mod:get_opt(iqdisc, Opts, no_queue), +%% Default IQDisc is no_queue: +%% executes disable/enable actions in the c2s process itself +start(HostType, #{iqdisc := IQDisc}) -> ejabberd_hooks:add(hooks(HostType)), gen_iq_handler:add_iq_handler_for_domain(HostType, ?NS_CC_2, ejabberd_sm, fun ?MODULE:iq_handler2/5, #{}, IQDisc), @@ -97,7 +97,10 @@ hooks(HostType) -> -spec config_spec() -> mongoose_config_spec:config_section(). config_spec() -> - #section{items = #{<<"iqdisc">> => mongoose_config_spec:iqdisc()}}. + #section{ + format_items = map, + items = #{<<"iqdisc">> => mongoose_config_spec:iqdisc()}, + defaults = #{<<"iqdisc">> => no_queue}}. -spec disco_local_features(mongoose_disco:feature_acc()) -> mongoose_disco:feature_acc(). disco_local_features(Acc = #{node := <<>>}) -> diff --git a/test/common/config_parser_helper.erl b/test/common/config_parser_helper.erl index 2b214e00f2a..af9824f9831 100644 --- a/test/common/config_parser_helper.erl +++ b/test/common/config_parser_helper.erl @@ -491,7 +491,7 @@ all_modules() -> validity_period => #{access => #{unit => minutes, value => 13}, refresh => #{unit => days, value => 13}}, iqdisc => one_queue}, - mod_carboncopy => [{iqdisc, no_queue}], + mod_carboncopy => #{iqdisc => no_queue}, mod_mam => mod_config(mod_mam, #{archive_chat_markers => true, @@ -675,7 +675,7 @@ pgsql_modules() -> #{mod_adhoc => default_mod_config(mod_adhoc), mod_amp => [], mod_blocking => default_mod_config(mod_blocking), mod_bosh => default_mod_config(mod_bosh), - mod_carboncopy => [], mod_commands => [], + mod_carboncopy => default_mod_config(mod_carboncopy), mod_commands => [], mod_disco => mod_config(mod_disco, #{users_can_see_hidden_services => false}), mod_last => mod_config(mod_last, #{backend => rdbms}), mod_muc_commands => [], mod_muc_light_commands => [], @@ -857,6 +857,8 @@ default_mod_config(mod_caps) -> cache_life_time => timer:hours(24) div 1000}; default_mod_config(mod_csi) -> #{buffer_max => 20}; +default_mod_config(mod_carboncopy) -> + #{iqdisc => no_queue}; default_mod_config(mod_disco) -> #{extra_domains => [], server_info => [], users_can_see_hidden_services => true, iqdisc => one_queue}; diff --git a/test/config_parser_SUITE.erl b/test/config_parser_SUITE.erl index 62a4e4d0e8d..cffca714463 100644 --- a/test/config_parser_SUITE.erl +++ b/test/config_parser_SUITE.erl @@ -1653,7 +1653,7 @@ mod_cache_users(_Config) -> ?errh(T(<<"number_of_segments">>, <<"infinity">>)). mod_carboncopy(_Config) -> - check_iqdisc(mod_carboncopy). + check_iqdisc_map(mod_carboncopy). mod_csi(_Config) -> check_module_defaults(mod_csi),