diff --git a/server/libs/dnser.rb b/server/libs/dnser.rb index 69f734e7..083d87fb 100644 --- a/server/libs/dnser.rb +++ b/server/libs/dnser.rb @@ -675,7 +675,9 @@ def serialize() ].pack("nnnnnn") questions.each do |q| - result += q.serialize() + unless q.nil? then + result += q.serialize() + end end answers.each do |a| @@ -841,6 +843,8 @@ def on_request() @thread = Thread.new() do |t| begin loop do + goterror=false + begin data = @s.recvfrom(65536) # Data is an array where the first element is the actual data, and the second is the host/port @@ -866,8 +870,13 @@ def on_request() end end end + rescue Exception => e + puts("Caught an error: #{e}") + puts(e.backtrace()) + goterror=true + end - if(!transaction.sent) + if(!goterror and !transaction.sent) begin proc.call(transaction) rescue StandardError => e