test/test_slow_server.rb in rubydns-0.6.7 vs test/test_slow_server.rb in rubydns-0.7.0
- old
+ new
@@ -36,19 +36,21 @@
IN = Resolv::DNS::Resource::IN
def self.run
RubyDNS::run_server(:listen => SERVER_PORTS) do
match(/\.*.com/, IN::A) do |transaction|
- transaction.defer!
-
- # No domain exists, after 5 seconds:
- EventMachine::Timer.new(5) do
- transaction.failure!(:NXDomain)
+ defer do |fiber|
+ # No domain exists, after 2 seconds:
+ EventMachine::Timer.new(2) do
+ transaction.fail!(:NXDomain)
+
+ fiber.resume
+ end
end
end
otherwise do |transaction|
- transaction.failure!(:NXDomain)
+ transaction.fail!(:NXDomain)
end
end
end
end