mirror of
https://github.com/lunarmodules/luasocket.git
synced 2024-11-08 06:18:21 +01:00
DNS lookup was taking too long and fucking up the connect tests.
This commit is contained in:
parent
62a4c505e4
commit
f67864f86c
@ -365,14 +365,16 @@ end
|
||||
------------------------------------------------------------------------
|
||||
function connect_timeout()
|
||||
io.write("connect with timeout (if it hangs, it failed): ")
|
||||
local t = socket.time()
|
||||
local c, e = socket.tcp()
|
||||
assert(c, e)
|
||||
c:settimeout(0.1)
|
||||
local r, e = c:connect("ibere.tecgraf.puc-rio.br", 80)
|
||||
ip = socket.dns.toip("ibere.tecgraf.puc-rio.br")
|
||||
if not ip then return end
|
||||
local t = socket.time()
|
||||
local r, e = c:connect(ip, 80)
|
||||
assert(not r, "should not connect")
|
||||
assert(e == "timeout", e)
|
||||
assert(socket.time() - t < 2, "took to long to give up")
|
||||
assert(socket.time() - t < 2, "took too long to give up.")
|
||||
c:close()
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user