Mercurial > prosody-hg
comparison 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 |
| parents | 9932a2a5b6de |
| children | 0107ed6744aa |
comparison
equal
deleted
inserted
replaced
| 9214:8b2b8f1a911f | 9215:b087b5047f86 |
|---|---|
| 4 -- | 4 -- |
| 5 -- This project is MIT/X11 licensed. Please see the | 5 -- This project is MIT/X11 licensed. Please see the |
| 6 -- COPYING file in the source package for more information. | 6 -- COPYING file in the source package for more information. |
| 7 -- | 7 -- |
| 8 | 8 |
| 9 if not (prosody and prosody.config_loaded) then | |
| 10 -- This module only supports loading inside Prosody, outside Prosody | |
| 11 -- you should directly require net.server_select or server_event, etc. | |
| 12 error(debug.traceback("Loading outside Prosody or Prosody not yet initialized"), 0); | |
| 13 end | |
| 14 | |
| 9 local log = require "util.logger".init("net.server"); | 15 local log = require "util.logger".init("net.server"); |
| 10 local server_type = prosody and require "core.configmanager".get("*", "network_backend") or "select"; | 16 local server_type = require "core.configmanager".get("*", "network_backend") or "select"; |
| 11 if prosody and require "core.configmanager".get("*", "use_libevent") then | 17 |
| 18 if require "core.configmanager".get("*", "use_libevent") then | |
| 12 server_type = "event"; | 19 server_type = "event"; |
| 13 end | 20 end |
| 14 | 21 |
| 15 if server_type == "event" then | 22 if server_type == "event" then |
| 16 if not pcall(require, "luaevent.core") then | 23 if not pcall(require, "luaevent.core") then |
