From b40b79873c9fd79c5fa0bfc1533619a384b26e83 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Thu, 8 Jul 2021 17:57:44 +0200 Subject: 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. --- net/server_epoll.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'net') diff --git a/net/server_epoll.lua b/net/server_epoll.lua index d4a08d3d..d2a1759b 100644 --- a/net/server_epoll.lua +++ b/net/server_epoll.lua @@ -698,8 +698,8 @@ function interface:onacceptable() client:starttls(self.tls_ctx); else client:add(true, false); - client:setreadtimeout(); client:onconnect(); + client:onreadable(); end end -- cgit v1.2.3