lib/rubydns/server.rb in rubydns-0.9.3 vs lib/rubydns/server.rb in rubydns-0.9.4

- old
+ new

@@ -55,12 +55,17 @@ def initialize(options = {}) @handlers = [] @logger = options[:logger] || Celluloid.logger @interfaces = options[:listen] || DEFAULT_INTERFACES + + @origin = options[:origin] || '.' end + # Records are relative to this origin: + attr_accessor :origin + attr_accessor :logger # Fire the named event as part of running the server. def fire(event_name) end @@ -89,14 +94,21 @@ transaction = nil begin query.question.each do |question, resource_class| - @logger.debug {"<#{query.id}> Processing question #{question} #{resource_class}..."} - - transaction = Transaction.new(self, query, question, resource_class, response, options) - - transaction.process + begin + question = question.without_origin(@origin) + + @logger.debug {"<#{query.id}> Processing question #{question} #{resource_class}..."} + + transaction = Transaction.new(self, query, question, resource_class, response, options) + + transaction.process + rescue Resolv::DNS::OriginError + # This is triggered if the question is not part of the specified @origin: + @logger.debug {"<#{query.id}> Skipping question #{question} #{resource_class} because #{$!}"} + end end rescue Celluloid::ResumableError raise rescue StandardError => error @logger.error "<#{query.id}> Exception thrown while processing #{transaction}!"