mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
add timeout.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22302 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
23843e8b3c
commit
9ddde2773f
1 changed files with 8 additions and 1 deletions
|
@ -251,6 +251,9 @@ class TestSocket < Test::Unit::TestCase
|
||||||
Addrinfo.udp(ai.ip_address, port).connect {|s|
|
Addrinfo.udp(ai.ip_address, port).connect {|s|
|
||||||
msg1 = "<<<#{ai.inspect}>>>"
|
msg1 = "<<<#{ai.inspect}>>>"
|
||||||
s.sendmsg msg1
|
s.sendmsg msg1
|
||||||
|
unless IO.select([s], nil, nil, 10)
|
||||||
|
raise "no response"
|
||||||
|
end
|
||||||
msg2, addr = s.recvmsg
|
msg2, addr = s.recvmsg
|
||||||
msg2, remote_address, local_address = Marshal.load(msg2)
|
msg2, remote_address, local_address = Marshal.load(msg2)
|
||||||
assert_equal(msg1, msg2)
|
assert_equal(msg1, msg2)
|
||||||
|
@ -260,7 +263,11 @@ class TestSocket < Test::Unit::TestCase
|
||||||
ensure
|
ensure
|
||||||
if th
|
if th
|
||||||
Addrinfo.udp("127.0.0.1", port).connect {|s| s.sendmsg "exit" }
|
Addrinfo.udp("127.0.0.1", port).connect {|s| s.sendmsg "exit" }
|
||||||
th.join
|
unless th.join(10)
|
||||||
|
Thread.kill th
|
||||||
|
th.join(10)
|
||||||
|
raise "thread killed"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue