@@ -295,7 +295,9 @@ handle_cast({dump, XML}, #state{dump_fd = Fd} = State) ->
295295handle_cast ({reload , NewOpts , OldOpts },
296296 # state {host = Host ,
297297 rtbl_host = OldRTBLHost ,
298- rtbl_domains_node = OldRTBLDomainsNode } = State ) ->
298+ rtbl_domains_node = OldRTBLDomainsNode ,
299+ rtbl_retry_timer = RTBLRetryTimer } = State ) ->
300+ misc :cancel_timer (RTBLRetryTimer ),
299301 State1 = case {gen_mod :get_opt (spam_dump_file , OldOpts ),
300302 gen_mod :get_opt (spam_dump_file , NewOpts )} of
301303 {OldDumpFile , NewDumpFile } when NewDumpFile /= OldDumpFile ->
@@ -375,8 +377,13 @@ handle_info(Info, State) ->
375377 {noreply , State }.
376378
377379-spec terminate (normal | shutdown | {shutdown , term ()} | term (), state ()) -> ok .
378- terminate (Reason , # state {host = Host , rtbl_host = RTBLHost , rtbl_domains_node = RTBLDomainsNode } = State ) ->
380+ terminate (Reason ,
381+ # state {host = Host ,
382+ rtbl_host = RTBLHost ,
383+ rtbl_domains_node = RTBLDomainsNode ,
384+ rtbl_retry_timer = RTBLRetryTimer } = State ) ->
379385 ? DEBUG (" Stopping spam filter process for ~s : ~p " , [Host , Reason ]),
386+ misc :cancel_timer (RTBLRetryTimer ),
380387 DumpFile = gen_mod :get_module_opt (Host , ? MODULE , spam_dump_file ),
381388 DumpFile1 = expand_host (DumpFile , Host ),
382389 close_dump_file (DumpFile1 , State ),
@@ -679,7 +686,7 @@ read_files(Files) ->
679686-spec line_parser (Type :: atom ()) -> fun ((binary ()) -> binary ()).
680687line_parser (jid ) -> fun parse_jid /1 ;
681688line_parser (url ) -> fun parse_url /1 ;
682- line_parser (_ ) -> fun trim /1 .
689+ line_parser (_ ) -> fun trim /1 .
683690
684691-spec read_file (filename (), fun ((binary ()) -> ljid () | url ()))
685692 -> jid_set () | url_set ().
@@ -934,7 +941,7 @@ get_commands_spec() ->
934941 args = [{host , binary }, {domain , binary }],
935942 result = {res , restuple }}
936943 ].
937-
944+
938945for_all_hosts (F , A ) ->
939946 try lists :map (
940947 fun (Host ) ->
@@ -968,13 +975,13 @@ reload_spam_filter_files(Host) ->
968975 LServer = jid :nameprep (Host ),
969976 Files = #{domains => gen_mod :get_module_opt (LServer , ? MODULE , spam_domains_file ),
970977 jid => gen_mod :get_module_opt (LServer , ? MODULE , spam_jids_file ),
971- url => gen_mod :get_module_opt (LServer , ? MODULE , spam_urls_file )},
978+ url => gen_mod :get_module_opt (LServer , ? MODULE , spam_urls_file )},
972979 case try_call_by_host (Host , {reload_files , Files }) of
973980 {spam_filter , ok } ->
974981 ok ;
975982 {spam_filter , {error , Txt }} ->
976983 {error , binary_to_list (Txt )};
977- {error , _R } = Error ->
984+ {error , _R } = Error ->
978985 Error
979986 end .
980987
@@ -1031,7 +1038,7 @@ expire_spam_filter_cache(Host, Age) ->
10311038 Error
10321039 end .
10331040
1034- -spec add_to_spam_filter_cache (binary (), binary ()) -> [{binary (), integer ()}] | {error , string ()}.
1041+ -spec add_to_spam_filter_cache (binary (), binary ()) -> [{binary (), integer ()}] | {error , string ()}.
10351042add_to_spam_filter_cache (<<" global" >>, JID ) ->
10361043 for_all_hosts (fun add_to_spam_filter_cache /2 , [JID ]);
10371044add_to_spam_filter_cache (Host , EncJID ) ->
0 commit comments