Comparison

core/portmanager.lua @ 6041:a97591d2e1ad

portmanager: Make maximum read size configurable, and default to 4KB
author Matthew Wild <mwild1@gmail.com>
date Sun, 30 Mar 2014 08:44:55 +0100
parent 5550:557583904dc5
child 6054:7a5ddbaf758d
child 7077:0386ccf20ac7
comparison
equal deleted inserted replaced
6040:b3b1c9da38fb 6041:a97591d2e1ad
26 end 26 end
27 if socket.tcp6 and config.get("*", "use_ipv6") ~= false then 27 if socket.tcp6 and config.get("*", "use_ipv6") ~= false then
28 table.insert(default_interfaces, "::"); 28 table.insert(default_interfaces, "::");
29 table.insert(default_local_interfaces, "::1"); 29 table.insert(default_local_interfaces, "::1");
30 end 30 end
31
32 local default_mode = config.get("*", "network_default_read_size") or 4096;
31 33
32 --- Private state 34 --- Private state
33 35
34 -- service_name -> { service_info, ... } 36 -- service_name -> { service_info, ... }
35 local services = setmetatable({}, { __index = function (t, k) rawset(t, k, {}); return rawget(t, k); end }); 37 local services = setmetatable({}, { __index = function (t, k) rawset(t, k, {}); return rawget(t, k); end });
109 or {service_info.default_port 111 or {service_info.default_port
110 or listener.default_port -- COMPAT w/pre-0.9 112 or listener.default_port -- COMPAT w/pre-0.9
111 } 113 }
112 bind_ports = set.new(type(bind_ports) ~= "table" and { bind_ports } or bind_ports ); 114 bind_ports = set.new(type(bind_ports) ~= "table" and { bind_ports } or bind_ports );
113 115
114 local mode, ssl = listener.default_mode or "*a"; 116 local mode, ssl = listener.default_mode or default_mode;
115 local hooked_ports = {}; 117 local hooked_ports = {};
116 118
117 for interface in bind_interfaces do 119 for interface in bind_interfaces do
118 for port in bind_ports do 120 for port in bind_ports do
119 local port_number = tonumber(port); 121 local port_number = tonumber(port);