Comparison

plugins/mod_component.lua @ 11540:1937b3c3efb5 0.11

mod_c2s, mod_s2s, mod_component, mod_bosh, mod_websockets: Set default stanza size limits c2s/bosh/ws streams will default to 256KB, s2s and components to 512KB. These values are aligned with ejabberd's default settings, which should reduce issues related to inconsistent size limits between servers on the XMPP network. The previous default (10MB) is excessive for any production server, and allows significant memory usage by even unauthenticated sessions.
author Matthew Wild <mwild1@gmail.com>
date Fri, 07 May 2021 17:03:49 +0100
parent 9562:acf74ad0b795
child 11560:3bbb1af92514
comparison
equal deleted inserted replaced
11539:3413fea9e6db 11540:1937b3c3efb5
25 local hosts = prosody.hosts; 25 local hosts = prosody.hosts;
26 26
27 local log = module._log; 27 local log = module._log;
28 28
29 local opt_keepalives = module:get_option_boolean("component_tcp_keepalives", module:get_option_boolean("tcp_keepalives", true)); 29 local opt_keepalives = module:get_option_boolean("component_tcp_keepalives", module:get_option_boolean("tcp_keepalives", true));
30 local stanza_size_limit = module:get_option_number("component_stanza_size_limit", module:get_option_number("s2s_stanza_size_limit", 1024*512));
30 31
31 local sessions = module:shared("sessions"); 32 local sessions = module:shared("sessions");
32 33
33 local function keepalive(event) 34 local function keepalive(event)
34 local session = event.session; 35 local session = event.session;
295 conn:setoption("keepalive", opt_keepalives); 296 conn:setoption("keepalive", opt_keepalives);
296 end 297 end
297 298
298 session.log("info", "Incoming Jabber component connection"); 299 session.log("info", "Incoming Jabber component connection");
299 300
300 local stream = new_xmpp_stream(session, stream_callbacks); 301 local stream = new_xmpp_stream(session, stream_callbacks, stanza_size_limit);
301 session.stream = stream; 302 session.stream = stream;
302 303
303 session.notopen = true; 304 session.notopen = true;
304 305
305 function session.reset_stream() 306 function session.reset_stream()