Mercurial > prosody-hg
comparison net/server_epoll.lua @ 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 | aa85cb5b859f |
| children | 05fefde93036 |
comparison
equal
deleted
inserted
replaced
| 10991:aa85cb5b859f | 10992:df3ee12acd8c |
|---|---|
| 72 | 72 |
| 73 -- EXPERIMENTAL | 73 -- EXPERIMENTAL |
| 74 -- Whether to kill connections in case of callback errors. | 74 -- Whether to kill connections in case of callback errors. |
| 75 fatal_errors = false; | 75 fatal_errors = false; |
| 76 | 76 |
| 77 -- Or disable protection (like server_select) for potential performance gains | |
| 78 protect_listeners = true; | |
| 79 | |
| 77 -- Attempt writes instantly | 80 -- Attempt writes instantly |
| 78 opportunistic_writes = false; | 81 opportunistic_writes = false; |
| 79 }}; | 82 }}; |
| 80 local cfg = default_config.__index; | 83 local cfg = default_config.__index; |
| 81 | 84 |
| 189 end | 192 end |
| 190 local listener = self.listeners["on"..what]; | 193 local listener = self.listeners["on"..what]; |
| 191 if not listener then | 194 if not listener then |
| 192 self:noise("Missing listener 'on%s'", what); -- uncomment for development and debugging | 195 self:noise("Missing listener 'on%s'", what); -- uncomment for development and debugging |
| 193 return; | 196 return; |
| 197 end | |
| 198 if not cfg.protect_listeners then | |
| 199 return listener(self, ...); | |
| 194 end | 200 end |
| 195 local onerror = self.listeners.onerror or traceback; | 201 local onerror = self.listeners.onerror or traceback; |
| 196 local ok, err = xpcall(listener, onerror, self, ...); | 202 local ok, err = xpcall(listener, onerror, self, ...); |
| 197 if not ok then | 203 if not ok then |
| 198 if cfg.fatal_errors then | 204 if cfg.fatal_errors then |
