Comparison

net/server_epoll.lua @ 11660:68f0196ece2a

net.server_epoll: Immediately attempt to read from newly accepted connections This may speed up client-first protocols (e.g. XMPP, HTTP and TLS) when the first client data already arrived by the time we accept() it. If LuaSocket supported TCP_DEFER_ACCEPT we could use that to further increase the chance that there's already data to handle. In case no data has arrived, no harm should be done, :onreadable would simply set the read timeout and we'll get back to it once there is something to handle.
author Kim Alvefur <zash@zash.se>
date Thu, 08 Jul 2021 17:57:44 +0200
parent 11659:00295a8e5bcf
child 11665:148075532021
comparison
equal deleted inserted replaced
11659:00295a8e5bcf 11660:68f0196ece2a
696 if self.tls_direct then 696 if self.tls_direct then
697 client:add(true, true); 697 client:add(true, true);
698 client:starttls(self.tls_ctx); 698 client:starttls(self.tls_ctx);
699 else 699 else
700 client:add(true, false); 700 client:add(true, false);
701 client:setreadtimeout();
702 client:onconnect(); 701 client:onconnect();
702 client:onreadable();
703 end 703 end
704 end 704 end
705 705
706 -- Initialization for outgoing connections 706 -- Initialization for outgoing connections
707 function interface:init() 707 function interface:init()