Diff

plugins/mod_c2s.lua @ 13209:c8d949cf6b09

plugins: Switch to :get_option_period() for time range options Improves readability ("1 day" vs 86400) and centralizes validation.
author Kim Alvefur <zash@zash.se>
date Sun, 16 Jul 2023 20:49:33 +0200
parent 13095:1693bd4de283
child 13213:50324f66ca2a
line wrap: on
line diff
--- a/plugins/mod_c2s.lua	Sun Jul 16 21:04:42 2023 +0200
+++ b/plugins/mod_c2s.lua	Sun Jul 16 20:49:33 2023 +0200
@@ -25,8 +25,8 @@
 
 local log = module._log;
 
-local c2s_timeout = module:get_option_number("c2s_timeout", 300);
-local stream_close_timeout = module:get_option_number("c2s_close_timeout", 5);
+local c2s_timeout = module:get_option_period("c2s_timeout", "5 minutes");
+local stream_close_timeout = module:get_option_period("c2s_close_timeout", 5);
 local opt_keepalives = module:get_option_boolean("c2s_tcp_keepalives", module:get_option_boolean("tcp_keepalives", true));
 local stanza_size_limit = module:get_option_number("c2s_stanza_size_limit", 1024*256);