Demoted UPSTREAM from constant to local variable. Minimizes scope.

This commit is contained in:
soh_cah_toa
2013-05-07 22:40:26 -04:00
parent 281cde1cbb
commit c7981f3c0d

View File

@@ -11,20 +11,15 @@ module DNS
include Singleton
UPSTREAM = RubyDNS::Resolver.new([[:udp, '8.8.8.8', 53], [:tcp, '8.8.8.8', 53]])
#def initialize(address, port)
#@address = address
#@port = port
#EventMachine::next_tick { run_server }
#end
#UPSTREAM = RubyDNS::Resolver.new([[:udp, '8.8.8.8', 53], [:tcp, '8.8.8.8', 53]])
def run_server(address, port)
EventMachine::next_tick do
RubyDNS::run_server(:listen => [[:udp, address, port]]) do
upstream = RubyDNS::Resolver.new([[:udp, '8.8.8.8', 53], [:tcp, '8.8.8.8', 53]])
otherwise do |transaction|
transaction.passthrough!(UPSTREAM)
transaction.passthrough!(upstream)
end
end
end