diff options
author | Matthew Wild <mwild1@gmail.com> | 2018-08-19 14:45:19 +0100 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2018-08-19 14:45:19 +0100 |
commit | 38042076143c181d121974d0798dd1bb9332baeb (patch) | |
tree | b3a62897eabecd80b51087352c33914eb3f9cb58 /net | |
parent | 644e76a64fef2036b75f4330204815be73160b7a (diff) | |
download | prosody-38042076143c181d121974d0798dd1bb9332baeb.tar.gz prosody-38042076143c181d121974d0798dd1bb9332baeb.zip |
net.server: Throw error when loading outside Prosody or Prosody config not loaded
Diffstat (limited to 'net')
-rw-r--r-- | net/server.lua | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/net/server.lua b/net/server.lua index d8f24847..abbb421d 100644 --- a/net/server.lua +++ b/net/server.lua @@ -6,9 +6,16 @@ -- COPYING file in the source package for more information. -- +if not (prosody and prosody.config_loaded) then + -- This module only supports loading inside Prosody, outside Prosody + -- you should directly require net.server_select or server_event, etc. + error(debug.traceback("Loading outside Prosody or Prosody not yet initialized"), 0); +end + local log = require "util.logger".init("net.server"); -local server_type = prosody and require "core.configmanager".get("*", "network_backend") or "select"; -if prosody and require "core.configmanager".get("*", "use_libevent") then +local server_type = require "core.configmanager".get("*", "network_backend") or "select"; + +if require "core.configmanager".get("*", "use_libevent") then server_type = "event"; end |