# HG changeset patch # User Kim Alvefur # Date 1558793671 -7200 # Node ID 72adf1f39404dc73306326812db00b1e07b624c8 # Parent 39ca4202ae1e408106ca4c8c9b5ec383441a62b1 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. diff -r 39ca4202ae1e -r 72adf1f39404 net/server_epoll.lua --- a/net/server_epoll.lua Sat May 25 16:09:26 2019 +0200 +++ b/net/server_epoll.lua Sat May 25 16:14:31 2019 +0200 @@ -61,6 +61,10 @@ -- 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 @@ 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;