Comparison

core/portmanager.lua @ 4616:03d9fe1bcdd3

portmanager: Fix pre-0.9 compatibility by taking default_interface and default_port from the listener instead of service table
author Matthew Wild <mwild1@gmail.com>
date Thu, 15 Mar 2012 03:02:09 +0000
parent 4615:29a9988c1e1b
child 4617:d8e56e6ac8d4
comparison
equal deleted inserted replaced
4615:29a9988c1e1b 4616:03d9fe1bcdd3
67 local service_info = services[service_name][1]; 67 local service_info = services[service_name][1];
68 if not service_info then 68 if not service_info then
69 return nil, "Unknown service: "..service_name; 69 return nil, "Unknown service: "..service_name;
70 end 70 end
71 71
72 local listener = service_info.listener;
73
72 local config_prefix = (service_info.config_prefix or service_name).."_"; 74 local config_prefix = (service_info.config_prefix or service_name).."_";
73 if config_prefix == "_" then 75 if config_prefix == "_" then
74 config_prefix = ""; 76 config_prefix = "";
75 end 77 end
76 78
77 local bind_interfaces = set.new(config.get("*", config_prefix.."interfaces") 79 local bind_interfaces = set.new(config.get("*", config_prefix.."interfaces")
78 or config.get("*", config_prefix.."interface") -- COMPAT w/pre-0.9 80 or config.get("*", config_prefix.."interface") -- COMPAT w/pre-0.9
79 or (service_info.private and default_local_interfaces) 81 or (service_info.private and default_local_interfaces)
80 or config.get("*", "interfaces") 82 or config.get("*", "interfaces")
81 or config.get("*", "interface") -- COMPAT w/pre-0.9 83 or config.get("*", "interface") -- COMPAT w/pre-0.9
82 or service_info.default_interface -- COMPAT w/pre0.9 84 or listener.default_interface -- COMPAT w/pre0.9
83 or default_interfaces); 85 or default_interfaces);
84 86
87 local bind_ports = set.new(config.get("*", config_prefix.."ports")
85 or service_info.default_ports 88 or service_info.default_ports
86 or {service_info.default_port}); 89 or {listener.default_port}); -- COMPAT w/pre-0.9
87 local bind_ports = set.new(config.get("*", config_prefix.."ports")
88 90
89 local listener = service_info.listener;
90 local mode = listener.default_mode or "*a"; 91 local mode = listener.default_mode or "*a";
91 local ssl; 92 local ssl;
92 if service_info.encryption == "ssl" then 93 if service_info.encryption == "ssl" then
93 ssl = prosody.global_ssl_ctx; 94 ssl = prosody.global_ssl_ctx;
94 if not ssl then 95 if not ssl then