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