diff options
author | Kim Alvefur <zash@zash.se> | 2020-06-30 18:31:48 +0200 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2020-06-30 18:31:48 +0200 |
commit | 8b9da402600ec5cea44968b05bfe0ccf92cf0999 (patch) | |
tree | db17f786029a587c271a16e4c04d775a6d113275 /net | |
parent | 7acd39cdbef144ecf3f32d4237de945c188fd5be (diff) | |
download | prosody-8b9da402600ec5cea44968b05bfe0ccf92cf0999.tar.gz prosody-8b9da402600ec5cea44968b05bfe0ccf92cf0999.zip |
net.server_epoll: Add setting for turning off callback protections
Might improve (CPU) performance at the risk of triggering top level
errors.
Diffstat (limited to 'net')
-rw-r--r-- | net/server_epoll.lua | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/net/server_epoll.lua b/net/server_epoll.lua index 5ad20371..f767db78 100644 --- a/net/server_epoll.lua +++ b/net/server_epoll.lua @@ -74,6 +74,9 @@ local default_config = { __index = { -- 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 @@ function interface:on(what, ...) 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 |