From 83c255e89f376068f632fc1f17e67253184e4451 Mon Sep 17 00:00:00 2001 From: usa Date: Sat, 3 Jul 2021 16:56:34 +0000 Subject: 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 --- lib/resolv.rb | 6 +++--- version.h | 2 +- 2 files changed, 4 insertions(+), 4 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 diff --git a/version.h b/version.h index 31a7605f40..e6003c2f6a 100644 --- a/version.h +++ b/version.h @@ -1,6 +1,6 @@ #define RUBY_VERSION "2.6.8" #define RUBY_RELEASE_DATE "2021-07-04" -#define RUBY_PATCHLEVEL 201 +#define RUBY_PATCHLEVEL 202 #define RUBY_RELEASE_YEAR 2021 #define RUBY_RELEASE_MONTH 7 -- cgit v1.2.1