Project

General

Profile

Bug #10747 ยป resolver-force-tcp.patch

patch to fall back to TCP when Errno::EACCES is caught - a13m (Andy Grimm), 01/16/2015 07:26 PM

View differences:

resolv.rb 2015-01-16 14:25:26.556225214 -0500
507 507

  
508 508
    def each_resource(name, typeclass, &proc)
509 509
      lazy_initialize
510
      requester = make_udp_requester
511 510
      senders = {}
511
      requester = nil
512
      begin
513
        requester = make_udp_requester
514
      rescue Errno::EACCES
515
        # fall back to TCP
516
      end
517

  
512 518
      begin
513 519
        @config.resolv(name) {|candidate, tout, nameserver, port|
520
          requester ||= make_tcp_requester(nameserver, port)
514 521
          msg = Message.new
515 522
          msg.rd = 1
516 523
          msg.add_question(candidate, typeclass)
......
542 549
          end
543 550
        }
544 551
      ensure
545
        requester.close
552
        requester.close unless requester.nil?
546 553
      end
547 554
    end
548 555