Software /
code /
prosody
Diff
net/server.lua @ 9215:b087b5047f86
net.server: Throw error when loading outside Prosody or Prosody config not loaded
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Sun, 19 Aug 2018 14:45:19 +0100 |
parent | 8711:9932a2a5b6de |
child | 10853:0107ed6744aa |
line wrap: on
line diff
--- a/net/server.lua Sun Aug 19 14:44:50 2018 +0100 +++ b/net/server.lua Sun Aug 19 14:45:19 2018 +0100 @@ -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