From 6d81c2b818239ab8e841319bd34185a125b70667 Mon Sep 17 00:00:00 2001 From: Cloud Wu Date: Tue, 1 Aug 2017 09:35:16 +0800 Subject: [PATCH] use socket.shutdown where timeout --- lualib/http/httpc.lua | 2 +- lualib/http/sockethelper.lua | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lualib/http/httpc.lua b/lualib/http/httpc.lua index 79e7db74..615d6017 100644 --- a/lualib/http/httpc.lua +++ b/lualib/http/httpc.lua @@ -106,7 +106,7 @@ function httpc.request(method, host, url, recvheader, header, content) if not finish then local temp = fd fd = nil - socket.close(temp) + socket.shutdown(temp) end end) end diff --git a/lualib/http/sockethelper.lua b/lualib/http/sockethelper.lua index f5d6ae80..10b32346 100644 --- a/lualib/http/sockethelper.lua +++ b/lualib/http/sockethelper.lua @@ -102,4 +102,8 @@ function sockethelper.close(fd) socket.close(fd) end +function sockethelper.shutdown(fd) + socket.shutdown(fd) +end + return sockethelper