Changeset

10992:df3ee12acd8c

net.server_epoll: Add setting for turning off callback protections Might improve (CPU) performance at the risk of triggering top level errors.
author Kim Alvefur <zash@zash.se>
date Tue, 30 Jun 2020 18:31:48 +0200
parents 10991:aa85cb5b859f
children 10993:b5e7f4d533e2
files net/server_epoll.lua
diffstat 1 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/net/server_epoll.lua	Tue Jun 30 17:35:07 2020 +0200
+++ b/net/server_epoll.lua	Tue Jun 30 18:31:48 2020 +0200
@@ -74,6 +74,9 @@
 	-- Whether to kill connections in case of callback errors.
 	fatal_errors = false;
 
+	-- Or disable protection (like server_select) for potential performance gains
+	protect_listeners = true;
+
 	-- Attempt writes instantly
 	opportunistic_writes = false;
 }};
@@ -192,6 +195,9 @@
 		self:noise("Missing listener 'on%s'", what); -- uncomment for development and debugging
 		return;
 	end
+	if not cfg.protect_listeners then
+		return listener(self, ...);
+	end
 	local onerror = self.listeners.onerror or traceback;
 	local ok, err = xpcall(listener, onerror, self, ...);
 	if not ok then