Comparison

core/portmanager.lua @ 9837:789395f027f1

core.portmanager: Reduce scope of variable Not sure why it was all the way out there, seems like there would have been unexpected behaviour from that
author Kim Alvefur <zash@zash.se>
date Wed, 10 Oct 2018 17:22:08 +0200
parent 9836:e487197ba8a5
child 9848:b923053e69ba
comparison
equal deleted inserted replaced
9836:e487197ba8a5 9837:789395f027f1
93 or {service_info.default_port 93 or {service_info.default_port
94 or listener.default_port -- COMPAT w/pre-0.9 94 or listener.default_port -- COMPAT w/pre-0.9
95 } 95 }
96 bind_ports = set.new(type(bind_ports) ~= "table" and { bind_ports } or bind_ports ); 96 bind_ports = set.new(type(bind_ports) ~= "table" and { bind_ports } or bind_ports );
97 97
98 local mode, ssl = listener.default_mode or default_mode; 98 local mode = listener.default_mode or default_mode;
99 local hooked_ports = {}; 99 local hooked_ports = {};
100 100
101 for interface in bind_interfaces do 101 for interface in bind_interfaces do
102 for port in bind_ports do 102 for port in bind_ports do
103 local port_number = tonumber(port); 103 local port_number = tonumber(port);
105 log("error", "Invalid port number specified for service '%s': %s", service_info.name, tostring(port)); 105 log("error", "Invalid port number specified for service '%s': %s", service_info.name, tostring(port));
106 elseif #active_services:search(nil, interface, port_number) > 0 then 106 elseif #active_services:search(nil, interface, port_number) > 0 then
107 log("error", "Multiple services configured to listen on the same port ([%s]:%d): %s, %s", interface, port, 107 log("error", "Multiple services configured to listen on the same port ([%s]:%d): %s, %s", interface, port,
108 active_services:search(nil, interface, port)[1][1].service.name or "<unnamed>", service_name or "<unnamed>"); 108 active_services:search(nil, interface, port)[1][1].service.name or "<unnamed>", service_name or "<unnamed>");
109 else 109 else
110 local err; 110 local ssl, err;
111 -- Create SSL context for this service/port 111 -- Create SSL context for this service/port
112 if service_info.encryption == "ssl" then 112 if service_info.encryption == "ssl" then
113 local global_ssl_config = config.get("*", "ssl") or {}; 113 local global_ssl_config = config.get("*", "ssl") or {};
114 local prefix_ssl_config = config.get("*", config_prefix.."ssl") or global_ssl_config; 114 local prefix_ssl_config = config.get("*", config_prefix.."ssl") or global_ssl_config;
115 ssl, err = certmanager.create_context(service_info.name.." port "..port, "server", 115 ssl, err = certmanager.create_context(service_info.name.." port "..port, "server",