aboutsummaryrefslogtreecommitdiffstats
path: root/net/server.lua
diff options
context:
space:
mode:
Diffstat (limited to 'net/server.lua')
-rw-r--r--net/server.lua11
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