Skip to content

Commit

Permalink
http中connect可能会连接失败,不应当将错误的fd继续传递下去
Browse files Browse the repository at this point in the history
  • Loading branch information
chengdd1987 committed Oct 17, 2017
1 parent 460ed2e commit 3715727
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lualib/http/httpc.lua
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,10 @@ function httpc.request(method, host, url, recvheader, header, content)
hostname = dns.resolve(hostname)
end
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
if timeout then
skynet.timeout(timeout, function()
Expand Down

0 comments on commit 3715727

Please sign in to comment.