Software /
code /
prosody
Comparison
prosody @ 4322:aff627b1ce95
connlistener, server_select, prosody: Add support for binding to multiple addresses
author | Florian Zeitz <florob@babelmonkeys.de> |
---|---|
date | Wed, 15 Jun 2011 23:44:18 +0200 |
parent | 4249:896e8793e7a4 |
child | 4382:29581d16450c |
comparison
equal
deleted
inserted
replaced
4321:4dcdba6900f2 | 4322:aff627b1ce95 |
---|---|
268 for _, port in ipairs(ports) do | 268 for _, port in ipairs(ports) do |
269 port = tonumber(port); | 269 port = tonumber(port); |
270 if type(port) ~= "number" then | 270 if type(port) ~= "number" then |
271 log("error", "Non-numeric "..ports_option..": "..tostring(port)); | 271 log("error", "Non-numeric "..ports_option..": "..tostring(port)); |
272 else | 272 else |
273 local ok, err = cl.start(listener, { | 273 local ok, errors = cl.start(listener, { |
274 ssl = conntype == "ssl" and global_ssl_ctx, | 274 ssl = conntype == "ssl" and global_ssl_ctx, |
275 port = port, | 275 port = port, |
276 interface = (option and config.get("*", "core", option.."_interface")) | 276 interface = (option and config.get("*", "core", option.."_interface")) |
277 or cl.get(listener).default_interface | 277 or cl.get(listener).default_interface |
278 or config.get("*", "core", "interface"), | 278 or config.get("*", "core", "interface"), |
279 type = conntype | 279 type = conntype |
280 }); | 280 }); |
281 if not ok then | 281 if not ok then |
282 local friendly_message = err; | 282 for addr, err in pairs(errors) do |
283 if err:match(" in use") then | 283 local friendly_message = err; |
284 if port == 5222 or port == 5223 or port == 5269 then | 284 if err:match(" in use") then |
285 friendly_message = "check that Prosody or another XMPP server is " | 285 if port == 5222 or port == 5223 or port == 5269 then |
286 .."not already running and using this port"; | 286 friendly_message = "check that Prosody or another XMPP server is " |
287 elseif port == 80 or port == 81 then | 287 .."not already running and using this port"; |
288 friendly_message = "check that a HTTP server is not already using " | 288 elseif port == 80 or port == 81 then |
289 .."this port"; | 289 friendly_message = "check that a HTTP server is not already using " |
290 elseif port == 5280 then | 290 .."this port"; |
291 friendly_message = "check that Prosody or a BOSH connection manager " | 291 elseif port == 5280 then |
292 .."is not already running"; | 292 friendly_message = "check that Prosody or a BOSH connection manager " |
293 else | 293 .."is not already running"; |
294 friendly_message = "this port is in use by another application"; | 294 else |
295 friendly_message = "this port is in use by another application"; | |
296 end | |
297 elseif err:match("permission") then | |
298 friendly_message = "Prosody does not have sufficient privileges to use this port"; | |
299 elseif err == "no ssl context" then | |
300 if not config.get("*", "core", "ssl") then | |
301 friendly_message = "there is no 'ssl' config under Host \"*\" which is " | |
302 .."require for legacy SSL ports"; | |
303 else | |
304 friendly_message = "initializing SSL support failed, see previous log entries"; | |
305 end | |
295 end | 306 end |
296 elseif err:match("permission") then | 307 log("error", "Failed to open server port %d on %s, %s", port, addr, friendly_message); |
297 friendly_message = "Prosody does not have sufficient privileges to use this port"; | |
298 elseif err == "no ssl context" then | |
299 if not config.get("*", "core", "ssl") then | |
300 friendly_message = "there is no 'ssl' config under Host \"*\" which is " | |
301 .."require for legacy SSL ports"; | |
302 else | |
303 friendly_message = "initializing SSL support failed, see previous log entries"; | |
304 end | |
305 end | 308 end |
306 log("error", "Failed to open server port %d, %s", port, friendly_message); | |
307 end | 309 end |
308 end | 310 end |
309 end | 311 end |
310 end | 312 end |
311 end | 313 end |