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 | 1c68fe88f708454b3c1fd9203d478c017df1b1cb (patch) | |
tree | b3a62897eabecd80b51087352c33914eb3f9cb58 | |
parent | cbaa78eccafb3b98ddd34385690c2e2ede04314c (diff) | |
download | prosody-1c68fe88f708454b3c1fd9203d478c017df1b1cb.tar.gz prosody-1c68fe88f708454b3c1fd9203d478c017df1b1cb.zip |
net.server: Throw error when loading outside Prosody or Prosody config not loaded
-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 |