aboutsummaryrefslogtreecommitdiffstats
path: root/prosody
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2010-01-31 16:40:47 +0000
committerMatthew Wild <mwild1@gmail.com>2010-01-31 16:40:47 +0000
commit43644666de538fedd188088111cefcead0f989db (patch)
tree451e60c2510aa3b223f380b5fc63722ea5c9e81a /prosody
parentda411ed5656f1d6332beaeeff3056a872bba7307 (diff)
downloadprosody-43644666de538fedd188088111cefcead0f989db.tar.gz
prosody-43644666de538fedd188088111cefcead0f989db.zip
prosody: Log error message when failing to open ports
Diffstat (limited to 'prosody')
-rwxr-xr-xprosody20
1 files changed, 19 insertions, 1 deletions
diff --git a/prosody b/prosody
index 01512c1b..05d91b7d 100755
--- a/prosody
+++ b/prosody
@@ -195,7 +195,7 @@ function init_global_state()
if type(port) ~= "number" then
log("error", "Non-numeric "..option.."_ports: "..tostring(port));
else
- cl.start(listener, {
+ local ok, err = cl.start(listener, {
ssl = conntype ~= "tcp" and global_ssl_ctx,
port = port,
interface = config.get("*", "core", option.."_interface")
@@ -203,6 +203,24 @@ function init_global_state()
or config.get("*", "core", "interface"),
type = conntype
});
+ if not ok then
+ local friendly_message = err;
+ if err:match(" in use") then
+ if port == 5222 or port == 5223 or port == 5269 then
+ friendly_message = "check that Prosody or another XMPP server is "
+ .."not already running and using this port";
+ elseif port == 80 or port == 81 then
+ friendly_message = "check that a HTTP server is not already using "
+ .."this port";
+ elseif port == 5280 then
+ friendly_message = "check that Prosody or a BOSH connection manager "
+ .."is not already running";
+ end
+ elseif err:match("permission") then
+ friendly_message = "Prosody does not have sufficient privileges to use this port";
+ end
+ log("error", "Failed to open server port %d, %s", port, friendly_message);
+ end
end
end
end