mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-22 02:53:09 +00:00
connect timeout, see #611
This commit is contained in:
@@ -2,7 +2,7 @@ local skynet = require "skynet"
|
||||
local httpc = require "http.httpc"
|
||||
local dns = require "dns"
|
||||
|
||||
skynet.start(function()
|
||||
local function main()
|
||||
httpc.dns() -- set dns server
|
||||
httpc.timeout = 100 -- set timeout 1 second
|
||||
print("GET baidu.com")
|
||||
@@ -21,6 +21,9 @@ skynet.start(function()
|
||||
print(string.format("GET %s (baidu.com)", ip))
|
||||
local status, body = httpc.get("baidu.com", "/", respheader, { host = "baidu.com" })
|
||||
print(status)
|
||||
end
|
||||
|
||||
skynet.start(function()
|
||||
print(pcall(main))
|
||||
skynet.exit()
|
||||
end)
|
||||
|
||||
Reference in New Issue
Block a user