aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_net_multiplex.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2020-08-02 00:24:54 +0200
committerKim Alvefur <zash@zash.se>2020-08-02 00:24:54 +0200
commita725ff6218040cf93b85fb634e6833f7e0e4fe52 (patch)
tree491a1d5adfc3c6d99c0188a09ca55cdfbed5a8d3 /plugins/mod_net_multiplex.lua
parentaa584a52866a38894a80def3da90990cc2f48134 (diff)
downloadprosody-a725ff6218040cf93b85fb634e6833f7e0e4fe52.tar.gz
prosody-a725ff6218040cf93b85fb634e6833f7e0e4fe52.zip
mod_net_multiplex: Set read size/mode to that of the target listener
Otherwise it would use the configured buffer size, or previously '*a'. Using the read size set by the listener seems more sensible.
Diffstat (limited to 'plugins/mod_net_multiplex.lua')
-rw-r--r--plugins/mod_net_multiplex.lua3
1 files changed, 3 insertions, 0 deletions
diff --git a/plugins/mod_net_multiplex.lua b/plugins/mod_net_multiplex.lua
index 42a41709..ddd58463 100644
--- a/plugins/mod_net_multiplex.lua
+++ b/plugins/mod_net_multiplex.lua
@@ -2,6 +2,7 @@ module:set_global();
local array = require "util.array";
local max_buffer_len = module:get_option_number("multiplex_buffer_size", 1024);
+local default_mode = module:get_option_number("network_default_read_size", 4096);
local portmanager = require "core.portmanager";
@@ -52,6 +53,7 @@ function listener.onconnect(conn)
module:log("debug", "Routing incoming connection to %s based on ALPN %q", service.name, selected_proto);
local next_listener = service.listener;
conn:setlistener(next_listener);
+ conn:set_mode(next_listener.default_mode or default_mode);
local onconnect = next_listener.onconnect;
if onconnect then return onconnect(conn) end
end
@@ -67,6 +69,7 @@ function listener.onincoming(conn, data)
module:log("debug", "Routing incoming connection to %s", service.name);
local next_listener = service.listener;
conn:setlistener(next_listener);
+ conn:set_mode(next_listener.default_mode or default_mode);
local onconnect = next_listener.onconnect;
if onconnect then onconnect(conn) end
return next_listener.onincoming(conn, buf);