Software / code / prosody
Comparison
net/server_epoll.lua @ 11685:247561bf6fca
net.server_epoll: Log failures to set socket options
Good to know if it fails, especially since the return value doesn't seem
to be checked anywhere.
Since LuaSec-wrapped sockets don't expose the setoption method, this
will likely show when mod_c2s tries to enable keepalives on direct tls
connections.
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Wed, 14 Jul 2021 22:04:23 +0200 |
| parent | 11677:98bcc19361db |
| child | 11686:f4c3dcc907d8 |
comparison
equal
deleted
inserted
replaced
| 11684:8b0baf3003fb | 11685:247561bf6fca |
|---|---|
| 279 self.read_size = new_mode; | 279 self.read_size = new_mode; |
| 280 end | 280 end |
| 281 | 281 |
| 282 function interface:setoption(k, v) | 282 function interface:setoption(k, v) |
| 283 -- LuaSec doesn't expose setoption :( | 283 -- LuaSec doesn't expose setoption :( |
| 284 if self.conn.setoption then | 284 local ok, ret, err = pcall(self.conn.setoption, self.conn, k, v); |
| 285 self.conn:setoption(k, v); | 285 if not ok then |
| 286 end | 286 self:noise("Setting option %q = %q failed: %s", k, v, ret); |
| 287 return ok, ret; | |
| 288 elseif not ret then | |
| 289 self:noise("Setting option %q = %q failed: %s", k, v, err); | |
| 290 return ret, err; | |
| 291 end | |
| 292 return ret; | |
| 287 end | 293 end |
| 288 | 294 |
| 289 -- Timeout for detecting dead or idle sockets | 295 -- Timeout for detecting dead or idle sockets |
| 290 function interface:setreadtimeout(t) | 296 function interface:setreadtimeout(t) |
| 291 if t == false then | 297 if t == false then |