aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2019-05-25 16:14:31 +0200
committerKim Alvefur <zash@zash.se>2019-05-25 16:14:31 +0200
commit0efe801b5d1e0b45cb16d8fdddaa3620d6317073 (patch)
treefc621f8faf59bcdddea293992f076dd1c6b80785
parent9b6e98a731cf360aa60c13df062c74b58a368b37 (diff)
downloadprosody-0efe801b5d1e0b45cb16d8fdddaa3620d6317073.tar.gz
prosody-0efe801b5d1e0b45cb16d8fdddaa3620d6317073.zip
net.server_epoll: Add experimental option to close connections in case of listener error
Sometimes such errors leave sessions in an inconsistent state, so it might be better to close them early.
-rw-r--r--net/server_epoll.lua8
1 files changed, 8 insertions, 0 deletions
diff --git a/net/server_epoll.lua b/net/server_epoll.lua
index 4061d755..251f91f7 100644
--- a/net/server_epoll.lua
+++ b/net/server_epoll.lua
@@ -61,6 +61,10 @@ local default_config = { __index = {
-- Maximum and minimum amount of time to sleep waiting for events (adjusted for pending timers)
max_wait = 86400;
min_wait = 1e-06;
+
+ -- EXPERIMENTAL
+ -- Whether to kill connections in case of callback errors.
+ fatal_errors = false;
}};
local cfg = default_config.__index;
@@ -162,6 +166,10 @@ function interface:on(what, ...)
local ok, err = pcall(listener, self, ...);
if not ok then
log("error", "Error calling on%s: %s", what, err);
+ if cfg.fatal_errors then
+ log("debug", "Closing %s due to error in listener", self);
+ self:destroy();
+ end
return nil, err;
end
return err;