Comparison

plugins/mod_c2s.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
child 11120:b2331f3dfeea
comparison
equal deleted inserted replaced
10849:19e7092e062c 10850:bd2814f900dd
24 local log = module._log; 24 local log = module._log;
25 25
26 local c2s_timeout = module:get_option_number("c2s_timeout", 300); 26 local c2s_timeout = module:get_option_number("c2s_timeout", 300);
27 local stream_close_timeout = module:get_option_number("c2s_close_timeout", 5); 27 local stream_close_timeout = module:get_option_number("c2s_close_timeout", 5);
28 local opt_keepalives = module:get_option_boolean("c2s_tcp_keepalives", module:get_option_boolean("tcp_keepalives", true)); 28 local opt_keepalives = module:get_option_boolean("c2s_tcp_keepalives", module:get_option_boolean("tcp_keepalives", true));
29 local stanza_size_limit = module:get_option_number("c2s_stanza_size_limit"); -- TODO come up with a sensible default (util.xmppstream defaults to 10M)
29 30
30 local measure_connections = module:measure("connections", "amount"); 31 local measure_connections = module:measure("connections", "amount");
31 local measure_ipv6 = module:measure("ipv6", "amount"); 32 local measure_ipv6 = module:measure("ipv6", "amount");
32 33
33 local sessions = module:shared("sessions"); 34 local sessions = module:shared("sessions");
278 conn:setoption("keepalive", opt_keepalives); 279 conn:setoption("keepalive", opt_keepalives);
279 end 280 end
280 281
281 session.close = session_close; 282 session.close = session_close;
282 283
283 local stream = new_xmpp_stream(session, stream_callbacks); 284 local stream = new_xmpp_stream(session, stream_callbacks, stanza_size_limit);
284 session.stream = stream; 285 session.stream = stream;
285 session.notopen = true; 286 session.notopen = true;
286 287
287 function session.reset_stream() 288 function session.reset_stream()
288 session.notopen = true; 289 session.notopen = true;