From e35cad3053cd68e6bf64c19f93090f711f974e49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=90=E7=86=8F?= Date: Fri, 29 Oct 2021 13:55:54 +0800 Subject: [PATCH] =?UTF-8?q?fix=20#1494=20socket=20read=E9=98=BB=E5=A1=9E?= =?UTF-8?q?=E9=97=AE=E9=A2=98=20(#1495)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix #1494 socket read阻塞问题 * 优化readfunc Co-authored-by: zixun --- lualib/http/tlshelper.lua | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lualib/http/tlshelper.lua b/lualib/http/tlshelper.lua index 05e3d3ae..359c423a 100644 --- a/lualib/http/tlshelper.lua +++ b/lualib/http/tlshelper.lua @@ -43,13 +43,16 @@ function tlshelper.closefunc(tls_ctx) end function tlshelper.readfunc(fd, tls_ctx) - local readfunc = socket.readfunc(fd) + local function readfunc() + readfunc = socket.readfunc(fd) + return "" + end local read_buff = "" return function (sz) if not sz then local s = "" if #read_buff == 0 then - local ds = readfunc(sz) + local ds = readfunc() s = tls_ctx:read(ds) end s = read_buff .. s