mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-25 04:33:05 +00:00
add socket.disconnected(), used by socketchannle. see #715
This commit is contained in:
@@ -104,17 +104,13 @@ function httpc.request(method, host, url, recvheader, header, content)
|
||||
if timeout then
|
||||
skynet.timeout(timeout, function()
|
||||
if not finish then
|
||||
local temp = fd
|
||||
fd = nil
|
||||
socket.shutdown(temp)
|
||||
socket.shutdown(fd) -- shutdown the socket fd, need close later.
|
||||
end
|
||||
end)
|
||||
end
|
||||
local ok , statuscode, body = pcall(request, fd,method, host, url, recvheader, header, content)
|
||||
finish = true
|
||||
if fd then -- may close by skynet.timeout
|
||||
socket.close(fd)
|
||||
end
|
||||
socket.close(fd)
|
||||
if ok then
|
||||
return statuscode, body
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user