Comparison

plugins/mod_bosh.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 12977:74b9e05af71e
child 13213:50324f66ca2a
comparison
equal deleted inserted replaced
13208:a7c6ea1c5308 13209:c8d949cf6b09
34 -- These constants are implicitly assumed within the code, and cannot be changed 34 -- These constants are implicitly assumed within the code, and cannot be changed
35 local BOSH_HOLD = 1; 35 local BOSH_HOLD = 1;
36 local BOSH_MAX_REQUESTS = 2; 36 local BOSH_MAX_REQUESTS = 2;
37 37
38 -- The number of seconds a BOSH session should remain open with no requests 38 -- The number of seconds a BOSH session should remain open with no requests
39 local bosh_max_inactivity = module:get_option_number("bosh_max_inactivity", 60); 39 local bosh_max_inactivity = module:get_option_period("bosh_max_inactivity", 60);
40 -- The minimum amount of time between requests with no payload 40 -- The minimum amount of time between requests with no payload
41 local bosh_max_polling = module:get_option_number("bosh_max_polling", 5); 41 local bosh_max_polling = module:get_option_period("bosh_max_polling", 5);
42 -- The maximum amount of time that the server will hold onto a request before replying 42 -- The maximum amount of time that the server will hold onto a request before replying
43 -- (the client can set this to a lower value when it connects, if it chooses) 43 -- (the client can set this to a lower value when it connects, if it chooses)
44 local bosh_max_wait = module:get_option_number("bosh_max_wait", 120); 44 local bosh_max_wait = module:get_option_period("bosh_max_wait", 120);
45 45
46 local consider_bosh_secure = module:get_option_boolean("consider_bosh_secure"); 46 local consider_bosh_secure = module:get_option_boolean("consider_bosh_secure");
47 local cross_domain = module:get_option("cross_domain_bosh"); 47 local cross_domain = module:get_option("cross_domain_bosh");
48 local stanza_size_limit = module:get_option_number("c2s_stanza_size_limit", 1024*256); 48 local stanza_size_limit = module:get_option_number("c2s_stanza_size_limit", 1024*256);
49 49