Comparison

net/server.lua @ 10853:0107ed6744aa

net.server: Switch to epoll backend by default (if util.poll is found)
author Matthew Wild <mwild1@gmail.com>
date Mon, 01 Jun 2020 13:43:35 +0100
parent 9215:b087b5047f86
child 11762:54530085dffe
comparison
equal deleted inserted replaced
10852:2e48aebdb915 10853:0107ed6744aa
11 -- you should directly require net.server_select or server_event, etc. 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); 12 error(debug.traceback("Loading outside Prosody or Prosody not yet initialized"), 0);
13 end 13 end
14 14
15 local log = require "util.logger".init("net.server"); 15 local log = require "util.logger".init("net.server");
16 local server_type = require "core.configmanager".get("*", "network_backend") or "select"; 16
17 local have_util_poll = pcall(require, "util.poll");
18 local default_backend = have_util_poll and "epoll" or "select";
19
20 local server_type = require "core.configmanager".get("*", "network_backend") or default_backend;
17 21
18 if require "core.configmanager".get("*", "use_libevent") then 22 if require "core.configmanager".get("*", "use_libevent") then
19 server_type = "event"; 23 server_type = "event";
20 end 24 end
21 25