Comparison

plugins/mod_c2s.lua @ 11118:ece430d49809 0.11 0.11.7

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 10013:62d8689beafb
child 11120:b2331f3dfeea
child 11507:133e8ed291fe
comparison
equal deleted inserted replaced
11117:590ac42d81c5 11118:ece430d49809
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");
260 conn:setoption("keepalive", opt_keepalives); 261 conn:setoption("keepalive", opt_keepalives);
261 end 262 end
262 263
263 session.close = session_close; 264 session.close = session_close;
264 265
265 local stream = new_xmpp_stream(session, stream_callbacks); 266 local stream = new_xmpp_stream(session, stream_callbacks, stanza_size_limit);
266 session.stream = stream; 267 session.stream = stream;
267 session.notopen = true; 268 session.notopen = true;
268 269
269 function session.reset_stream() 270 function session.reset_stream()
270 session.notopen = true; 271 session.notopen = true;