mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Fallback to TCP in resolv if UDP bind raises EACCES
Original patch from Andy Grimm. Fixes [Bug #10747]
This commit is contained in:
parent
62d4382877
commit
f37cc1c719
Notes:
git
2019-10-22 04:49:05 +09:00
1 changed files with 7 additions and 2 deletions
|
|
@ -514,10 +514,15 @@ class Resolv
|
|||
|
||||
def fetch_resource(name, typeclass)
|
||||
lazy_initialize
|
||||
requester = make_udp_requester
|
||||
begin
|
||||
requester = make_udp_requester
|
||||
rescue Errno::EACCES
|
||||
# fall back to TCP
|
||||
end
|
||||
senders = {}
|
||||
begin
|
||||
@config.resolv(name) {|candidate, tout, nameserver, port|
|
||||
requester ||= make_tcp_requester(nameserver, port)
|
||||
msg = Message.new
|
||||
msg.rd = 1
|
||||
msg.add_question(candidate, typeclass)
|
||||
|
|
@ -550,7 +555,7 @@ class Resolv
|
|||
end
|
||||
}
|
||||
ensure
|
||||
requester.close
|
||||
requester&.close
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue