Software /
code /
prosody
Comparison
net/server_epoll.lua @ 10081:72adf1f39404
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.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sat, 25 May 2019 16:14:31 +0200 |
parent | 10080:39ca4202ae1e |
child | 10082:1df53ef1f60d |
comparison
equal
deleted
inserted
replaced
10080:39ca4202ae1e | 10081:72adf1f39404 |
---|---|
59 ssl_handshake_timeout = 60; | 59 ssl_handshake_timeout = 60; |
60 | 60 |
61 -- Maximum and minimum amount of time to sleep waiting for events (adjusted for pending timers) | 61 -- Maximum and minimum amount of time to sleep waiting for events (adjusted for pending timers) |
62 max_wait = 86400; | 62 max_wait = 86400; |
63 min_wait = 1e-06; | 63 min_wait = 1e-06; |
64 | |
65 -- EXPERIMENTAL | |
66 -- Whether to kill connections in case of callback errors. | |
67 fatal_errors = false; | |
64 }}; | 68 }}; |
65 local cfg = default_config.__index; | 69 local cfg = default_config.__index; |
66 | 70 |
67 local fds = createtable(10, 0); -- FD -> conn | 71 local fds = createtable(10, 0); -- FD -> conn |
68 | 72 |
160 return; | 164 return; |
161 end | 165 end |
162 local ok, err = pcall(listener, self, ...); | 166 local ok, err = pcall(listener, self, ...); |
163 if not ok then | 167 if not ok then |
164 log("error", "Error calling on%s: %s", what, err); | 168 log("error", "Error calling on%s: %s", what, err); |
169 if cfg.fatal_errors then | |
170 log("debug", "Closing %s due to error in listener", self); | |
171 self:destroy(); | |
172 end | |
165 return nil, err; | 173 return nil, err; |
166 end | 174 end |
167 return err; | 175 return err; |
168 end | 176 end |
169 | 177 |