Changeset

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
parents 10852:2e48aebdb915
children 10854:472fe13a05f9
files net/server.lua
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/net/server.lua	Mon Jun 01 13:41:41 2020 +0100
+++ b/net/server.lua	Mon Jun 01 13:43:35 2020 +0100
@@ -13,7 +13,11 @@
 end
 
 local log = require "util.logger".init("net.server");
-local server_type = require "core.configmanager".get("*", "network_backend") or "select";
+
+local have_util_poll = pcall(require, "util.poll");
+local default_backend = have_util_poll and "epoll" or "select";
+
+local server_type = require "core.configmanager".get("*", "network_backend") or default_backend;
 
 if require "core.configmanager".get("*", "use_libevent") then
 	server_type = "event";