mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-25 12:43:09 +00:00
close socket after request
This commit is contained in:
@@ -81,10 +81,10 @@ function httpc.request(method, host, url, recvheader, header, content)
|
|||||||
end
|
end
|
||||||
local fd = socket.connect(hostname, port)
|
local fd = socket.connect(hostname, port)
|
||||||
local ok , statuscode, body = pcall(request, fd,method, host, url, recvheader, header, content)
|
local ok , statuscode, body = pcall(request, fd,method, host, url, recvheader, header, content)
|
||||||
|
socket.close(fd)
|
||||||
if ok then
|
if ok then
|
||||||
return statuscode, body
|
return statuscode, body
|
||||||
else
|
else
|
||||||
socket.close(fd)
|
|
||||||
error(statuscode)
|
error(statuscode)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user