Software /
code /
prosody
Comparison
core/portmanager.lua @ 5776:bd0ff8ae98a8
Remove all trailing whitespace
author | Florian Zeitz <florob@babelmonkeys.de> |
---|---|
date | Fri, 09 Aug 2013 17:48:21 +0200 |
parent | 5550:557583904dc5 |
child | 6054:7a5ddbaf758d |
comparison
equal
deleted
inserted
replaced
5775:a6c2b8933507 | 5776:bd0ff8ae98a8 |
---|---|
85 function activate(service_name) | 85 function activate(service_name) |
86 local service_info = services[service_name][1]; | 86 local service_info = services[service_name][1]; |
87 if not service_info then | 87 if not service_info then |
88 return nil, "Unknown service: "..service_name; | 88 return nil, "Unknown service: "..service_name; |
89 end | 89 end |
90 | 90 |
91 local listener = service_info.listener; | 91 local listener = service_info.listener; |
92 | 92 |
93 local config_prefix = (service_info.config_prefix or service_name).."_"; | 93 local config_prefix = (service_info.config_prefix or service_name).."_"; |
94 if config_prefix == "_" then | 94 if config_prefix == "_" then |
95 config_prefix = ""; | 95 config_prefix = ""; |
101 or config.get("*", "interfaces") | 101 or config.get("*", "interfaces") |
102 or config.get("*", "interface") -- COMPAT w/pre-0.9 | 102 or config.get("*", "interface") -- COMPAT w/pre-0.9 |
103 or listener.default_interface -- COMPAT w/pre0.9 | 103 or listener.default_interface -- COMPAT w/pre0.9 |
104 or default_interfaces | 104 or default_interfaces |
105 bind_interfaces = set.new(type(bind_interfaces)~="table" and {bind_interfaces} or bind_interfaces); | 105 bind_interfaces = set.new(type(bind_interfaces)~="table" and {bind_interfaces} or bind_interfaces); |
106 | 106 |
107 local bind_ports = config.get("*", config_prefix.."ports") | 107 local bind_ports = config.get("*", config_prefix.."ports") |
108 or service_info.default_ports | 108 or service_info.default_ports |
109 or {service_info.default_port | 109 or {service_info.default_port |
110 or listener.default_port -- COMPAT w/pre-0.9 | 110 or listener.default_port -- COMPAT w/pre-0.9 |
111 } | 111 } |
112 bind_ports = set.new(type(bind_ports) ~= "table" and { bind_ports } or bind_ports ); | 112 bind_ports = set.new(type(bind_ports) ~= "table" and { bind_ports } or bind_ports ); |
113 | 113 |
114 local mode, ssl = listener.default_mode or "*a"; | 114 local mode, ssl = listener.default_mode or "*a"; |
115 local hooked_ports = {}; | 115 local hooked_ports = {}; |
116 | 116 |
117 for interface in bind_interfaces do | 117 for interface in bind_interfaces do |
118 for port in bind_ports do | 118 for port in bind_ports do |
119 local port_number = tonumber(port); | 119 local port_number = tonumber(port); |
120 if not port_number then | 120 if not port_number then |
121 log("error", "Invalid port number specified for service '%s': %s", service_info.name, tostring(port)); | 121 log("error", "Invalid port number specified for service '%s': %s", service_info.name, tostring(port)); |
186 local ok, err = activate(service_name); | 186 local ok, err = activate(service_name); |
187 if not ok then | 187 if not ok then |
188 log("error", "Failed to activate service '%s': %s", service_name, err or "unknown error"); | 188 log("error", "Failed to activate service '%s': %s", service_name, err or "unknown error"); |
189 end | 189 end |
190 end | 190 end |
191 | 191 |
192 fire_event("service-added", { name = service_name, service = service_info }); | 192 fire_event("service-added", { name = service_name, service = service_info }); |
193 return true; | 193 return true; |
194 end | 194 end |
195 | 195 |
196 function unregister_service(service_name, service_info) | 196 function unregister_service(service_name, service_info) |