Comparison

net/server_epoll.lua @ 9311:9b0604fe01f1

net.server_epoll: Make read_size a server-wide option Can still be overriden per connection
author Kim Alvefur <zash@zash.se>
date Thu, 13 Sep 2018 21:09:55 +0200
parent 9310:2d2d4c293efa
child 9314:c9eef7e8ee65
comparison
equal deleted inserted replaced
9310:2d2d4c293efa 9311:9b0604fe01f1
35 read_timeout = 14 * 60; 35 read_timeout = 14 * 60;
36 write_timeout = 7; 36 write_timeout = 7;
37 tcp_backlog = 128; 37 tcp_backlog = 128;
38 accept_retry_interval = 10; 38 accept_retry_interval = 10;
39 read_retry_delay = 1e-06; 39 read_retry_delay = 1e-06;
40 read_size = 8192;
40 connect_timeout = 20; 41 connect_timeout = 20;
41 handshake_timeout = 60; 42 handshake_timeout = 60;
42 max_wait = 86400; 43 max_wait = 86400;
43 min_wait = 1e-06; 44 min_wait = 1e-06;
44 }}; 45 }};
304 return true; 305 return true;
305 end 306 end
306 307
307 -- Called when socket is readable 308 -- Called when socket is readable
308 function interface:onreadable() 309 function interface:onreadable()
309 local data, err, partial = self.conn:receive(self.read_size); 310 local data, err, partial = self.conn:receive(self.read_size or cfg.read_size);
310 if data then 311 if data then
311 self:onconnect(); 312 self:onconnect();
312 self:on("incoming", data); 313 self:on("incoming", data);
313 else 314 else
314 if partial and partial ~= "" then 315 if partial and partial ~= "" then