X-Git-Url: https://git.enpas.org/?a=blobdiff_plain;f=prosody;h=96223c72f2b7506e88745e1757911a822c66b092;hb=fa11f8792d54f8043aea88f0fdf37d43b6971f28;hp=829ca4c41fc955f404c62a58e0cd968ec6424437;hpb=fc6c707d0b30015b18cdb3ce12db060a925e408a;p=prosody.git diff --git a/prosody b/prosody index 829ca4c4..96223c72 100755 --- a/prosody +++ b/prosody @@ -32,8 +32,10 @@ if CFG_DATADIR then end end --- Required to be able to find packages installed with luarocks -pcall(require, "luarocks.require"); +-- Check runtime dependencies +if not require "util.dependencies".check_dependencies() then + os.exit(1); +end -- Replace require() with one that doesn't pollute _G, required -- for neat sandboxing of modules @@ -113,9 +115,6 @@ function load_libraries() -- Initialize logging require "core.loggingmanager" - -- Check runtime dependencies - require "util.dependencies" - -- Load socket framework server = require "net.server" end @@ -206,14 +205,32 @@ function init_global_state() if type(port) ~= "number" then log("error", "Non-numeric "..ports_option..": "..tostring(port)); else - cl.start(listener, { - ssl = conntype ~= "tcp" and global_ssl_ctx, + local ok, err = cl.start(listener, { + ssl = conntype == "ssl" and global_ssl_ctx, port = port, interface = (option and config.get("*", "core", option.."_interface")) or cl.get(listener).default_interface 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