summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2021-07-03 16:56:34 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2021-07-03 16:56:34 +0000
commit83c255e89f376068f632fc1f17e67253184e4451 (patch)
tree69bd82f19ceaf338fbc5c2e8cd3f75587034765d /lib
parent67b324529b378c34fcc0fd910fa4139fc6cc5478 (diff)
merge revision(s) 9edc1625: [Backport #17781]
[ruby/resolv] Fix confusion of received response message This is a follow up for commit 33fb966197f1 ("Remove sender/message_id pair after response received in resolv", 2020-09-11). As the @senders instance variable is also used for tracking transaction ID allocation, simply removing an entry without releasing the ID would eventually deplete the ID space and cause Resolv::DNS.allocate_request_id to hang. It seems the intention of the code was to check that the received DNS message is actually the response for the question made within the method earlier. Let's have it actually do so. [Bug #12838] https://bugs.ruby-lang.org/issues/12838 [Bug #17748] https://bugs.ruby-lang.org/issues/17748 https://github.com/ruby/resolv/commit/53ca9c9209 --- lib/resolv.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_6@67946 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r--lib/resolv.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/resolv.rb b/lib/resolv.rb
index 93b57c62d8..02c2dedc49 100644
--- a/lib/resolv.rb
+++ b/lib/resolv.rb
@@ -691,17 +691,17 @@ class Resolv
rescue DecodeError
next # broken DNS message ignored
end
- if s = sender_for(from, msg)
+ if sender == sender_for(from, msg)
break
else
# unexpected DNS message ignored
end
end
- return msg, s.data
+ return msg, sender.data
end
def sender_for(addr, msg)
- @senders.delete([addr,msg.id])
+ @senders[[addr,msg.id]]
end
def close