Comparison

plugins/mod_s2s/mod_s2s.lua @ 10850:bd2814f900dd

mod_c2s,mod_s2s: Make stanza size limits configurable
author Kim Alvefur <zash@zash.se>
date Sun, 31 May 2020 22:39:34 +0200
parent 10849:19e7092e062c
comparison
equal deleted inserted replaced
10849:19e7092e062c 10850:bd2814f900dd
37 local opt_keepalives = module:get_option_boolean("s2s_tcp_keepalives", module:get_option_boolean("tcp_keepalives", true)); 37 local opt_keepalives = module:get_option_boolean("s2s_tcp_keepalives", module:get_option_boolean("tcp_keepalives", true));
38 local secure_auth = module:get_option_boolean("s2s_secure_auth", false); -- One day... 38 local secure_auth = module:get_option_boolean("s2s_secure_auth", false); -- One day...
39 local secure_domains, insecure_domains = 39 local secure_domains, insecure_domains =
40 module:get_option_set("s2s_secure_domains", {})._items, module:get_option_set("s2s_insecure_domains", {})._items; 40 module:get_option_set("s2s_secure_domains", {})._items, module:get_option_set("s2s_insecure_domains", {})._items;
41 local require_encryption = module:get_option_boolean("s2s_require_encryption", false); 41 local require_encryption = module:get_option_boolean("s2s_require_encryption", false);
42 local stanza_size_limit = module:get_option_number("s2s_stanza_size_limit"); -- TODO come up with a sensible default (util.xmppstream defaults to 10M)
42 43
43 local measure_connections = module:measure("connections", "amount"); 44 local measure_connections = module:measure("connections", "amount");
44 local measure_ipv6 = module:measure("ipv6", "amount"); 45 local measure_ipv6 = module:measure("ipv6", "amount");
45 46
46 local sessions = module:shared("sessions"); 47 local sessions = module:shared("sessions");
564 end 565 end
565 end 566 end
566 567
567 -- Session initialization logic shared by incoming and outgoing 568 -- Session initialization logic shared by incoming and outgoing
568 local function initialize_session(session) 569 local function initialize_session(session)
569 local stream = new_xmpp_stream(session, stream_callbacks); 570 local stream = new_xmpp_stream(session, stream_callbacks, stanza_size_limit);
570 571
571 session.thread = runner(function (stanza) 572 session.thread = runner(function (stanza)
572 if st.is_stanza(stanza) then 573 if st.is_stanza(stanza) then
573 core_process_stanza(session, stanza); 574 core_process_stanza(session, stanza);
574 elseif stanza.stream == "opened" then 575 elseif stanza.stream == "opened" then