Comparison

net/server_epoll.lua @ 9823:b61ba4496923

Merge 0.11->trunk
author Kim Alvefur <zash@zash.se>
date Sat, 09 Feb 2019 19:36:35 +0100
parent 9696:ed0917381b4d
parent 9822:13c2707d2417
child 9824:729de68f0068
comparison
equal deleted inserted replaced
9820:87a1742f928d 9823:b61ba4496923
37 local default_config = { __index = { 37 local default_config = { __index = {
38 -- If a connection is silent for this long, close it unless onreadtimeout says not to 38 -- If a connection is silent for this long, close it unless onreadtimeout says not to
39 read_timeout = 14 * 60; 39 read_timeout = 14 * 60;
40 40
41 -- How long to wait for a socket to become writable after queuing data to send 41 -- How long to wait for a socket to become writable after queuing data to send
42 write_timeout = 60; 42 send_timeout = 60;
43 43
44 -- Some number possibly influencing how many pending connections can be accepted 44 -- Some number possibly influencing how many pending connections can be accepted
45 tcp_backlog = 128; 45 tcp_backlog = 128;
46 46
47 -- If accepting a new incoming connection fails, wait this long before trying again 47 -- If accepting a new incoming connection fails, wait this long before trying again
52 52
53 -- Size of chunks to read from sockets 53 -- Size of chunks to read from sockets
54 read_size = 8192; 54 read_size = 8192;
55 55
56 -- Timeout used during between steps in TLS handshakes 56 -- Timeout used during between steps in TLS handshakes
57 handshake_timeout = 60; 57 ssl_handshake_timeout = 60;
58 58
59 -- Maximum and minimum amount of time to sleep waiting for events (adjusted for pending timers) 59 -- Maximum and minimum amount of time to sleep waiting for events (adjusted for pending timers)
60 max_wait = 86400; 60 max_wait = 86400;
61 min_wait = 1e-06; 61 min_wait = 1e-06;
62 }}; 62 }};
269 self._writetimeout:close(); 269 self._writetimeout:close();
270 self._writetimeout = nil; 270 self._writetimeout = nil;
271 end 271 end
272 return 272 return
273 end 273 end
274 t = t or cfg.write_timeout; 274 t = t or cfg.send_timeout;
275 if self._writetimeout then 275 if self._writetimeout then
276 self._writetimeout[1] = gettime() + t; 276 self._writetimeout[1] = gettime() + t;
277 resort_timers = true; 277 resort_timers = true;
278 else 278 else
279 self._writetimeout = addtimer(t, function () 279 self._writetimeout = addtimer(t, function ()
521 self:setwritetimeout(); 521 self:setwritetimeout();
522 self:set(true, true); 522 self:set(true, true);
523 elseif err == "wantread" then 523 elseif err == "wantread" then
524 log("debug", "TLS handshake on %s to wait until readable", self); 524 log("debug", "TLS handshake on %s to wait until readable", self);
525 self:set(true, false); 525 self:set(true, false);
526 self:setreadtimeout(cfg.handshake_timeout); 526 self:setreadtimeout(cfg.ssl_handshake_timeout);
527 elseif err == "wantwrite" then 527 elseif err == "wantwrite" then
528 log("debug", "TLS handshake on %s to wait until writable", self); 528 log("debug", "TLS handshake on %s to wait until writable", self);
529 self:set(false, true); 529 self:set(false, true);
530 self:setwritetimeout(cfg.handshake_timeout); 530 self:setwritetimeout(cfg.ssl_handshake_timeout);
531 else 531 else
532 log("debug", "TLS handshake error on %s: %s", self, err); 532 log("debug", "TLS handshake error on %s: %s", self, err);
533 self:on("disconnect", err); 533 self:on("disconnect", err);
534 self:destroy(); 534 self:destroy();
535 end 535 end