mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-25 04:33:05 +00:00
http中connect可能会连接失败,不应当将错误的fd继续传递下去
This commit is contained in:
@@ -100,6 +100,10 @@ function httpc.request(method, host, url, recvheader, header, content)
|
|||||||
hostname = dns.resolve(hostname)
|
hostname = dns.resolve(hostname)
|
||||||
end
|
end
|
||||||
local fd = socket.connect(hostname, port, timeout)
|
local fd = socket.connect(hostname, port, timeout)
|
||||||
|
if not fd then
|
||||||
|
error(string.format("http connect error host:%s, port:%s, timeout:%s", hostname, port, timeout))
|
||||||
|
return
|
||||||
|
end
|
||||||
local finish
|
local finish
|
||||||
if timeout then
|
if timeout then
|
||||||
skynet.timeout(timeout, function()
|
skynet.timeout(timeout, function()
|
||||||
|
|||||||
Reference in New Issue
Block a user