203 for _, port in ipairs(ports) do |
203 for _, port in ipairs(ports) do |
204 port = tonumber(port); |
204 port = tonumber(port); |
205 if type(port) ~= "number" then |
205 if type(port) ~= "number" then |
206 log("error", "Non-numeric "..ports_option..": "..tostring(port)); |
206 log("error", "Non-numeric "..ports_option..": "..tostring(port)); |
207 else |
207 else |
208 cl.start(listener, { |
208 local ok, err = cl.start(listener, { |
209 ssl = conntype == "ssl" and global_ssl_ctx, |
209 ssl = conntype == "ssl" and global_ssl_ctx, |
210 port = port, |
210 port = port, |
211 interface = (option and config.get("*", "core", option.."_interface")) |
211 interface = (option and config.get("*", "core", option.."_interface")) |
212 or cl.get(listener).default_interface |
212 or cl.get(listener).default_interface |
213 or config.get("*", "core", "interface"), |
213 or config.get("*", "core", "interface"), |
214 type = conntype |
214 type = conntype |
215 }); |
215 }); |
|
216 if not ok then |
|
217 local friendly_message = err; |
|
218 if err:match(" in use") then |
|
219 if port == 5222 or port == 5223 or port == 5269 then |
|
220 friendly_message = "check that Prosody or another XMPP server is " |
|
221 .."not already running and using this port"; |
|
222 elseif port == 80 or port == 81 then |
|
223 friendly_message = "check that a HTTP server is not already using " |
|
224 .."this port"; |
|
225 elseif port == 5280 then |
|
226 friendly_message = "check that Prosody or a BOSH connection manager " |
|
227 .."is not already running"; |
|
228 end |
|
229 elseif err:match("permission") then |
|
230 friendly_message = "Prosody does not have sufficient privileges to use this port"; |
|
231 end |
|
232 log("error", "Failed to open server port %d, %s", port, friendly_message); |
|
233 end |
216 end |
234 end |
217 end |
235 end |
218 end |
236 end |
219 end |
237 end |
220 end |
238 end |