diff options
author | Diego Nehab <diego@tecgraf.puc-rio.br> | 2004-01-24 03:21:33 +0000 |
---|---|---|
committer | Diego Nehab <diego@tecgraf.puc-rio.br> | 2004-01-24 03:21:33 +0000 |
commit | f67864f86c7d703325e86b14d0ba33992c52891b (patch) | |
tree | 9b54bde38b03d77a40fcc464dd7ee6006a255c43 | |
parent | 62a4c505e488c714e8795ea85564504562d30301 (diff) | |
download | luasocket-f67864f86c7d703325e86b14d0ba33992c52891b.tar.gz luasocket-f67864f86c7d703325e86b14d0ba33992c52891b.tar.bz2 luasocket-f67864f86c7d703325e86b14d0ba33992c52891b.zip |
DNS lookup was taking too long and fucking up the connect tests.
-rw-r--r-- | test/testclnt.lua | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/test/testclnt.lua b/test/testclnt.lua index 5f366b2..348439a 100644 --- a/test/testclnt.lua +++ b/test/testclnt.lua | |||
@@ -365,14 +365,16 @@ end | |||
365 | ------------------------------------------------------------------------ | 365 | ------------------------------------------------------------------------ |
366 | function connect_timeout() | 366 | function connect_timeout() |
367 | io.write("connect with timeout (if it hangs, it failed): ") | 367 | io.write("connect with timeout (if it hangs, it failed): ") |
368 | local t = socket.time() | ||
369 | local c, e = socket.tcp() | 368 | local c, e = socket.tcp() |
370 | assert(c, e) | 369 | assert(c, e) |
371 | c:settimeout(0.1) | 370 | c:settimeout(0.1) |
372 | local r, e = c:connect("ibere.tecgraf.puc-rio.br", 80) | 371 | ip = socket.dns.toip("ibere.tecgraf.puc-rio.br") |
372 | if not ip then return end | ||
373 | local t = socket.time() | ||
374 | local r, e = c:connect(ip, 80) | ||
373 | assert(not r, "should not connect") | 375 | assert(not r, "should not connect") |
374 | assert(e == "timeout", e) | 376 | assert(e == "timeout", e) |
375 | assert(socket.time() - t < 2, "took to long to give up") | 377 | assert(socket.time() - t < 2, "took too long to give up.") |
376 | c:close() | 378 | c:close() |
377 | end | 379 | end |
378 | 380 | ||