summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNAKAMURA Usaku <usa@ruby-lang.org>2021-06-02 01:40:08 +0900
committerNAKAMURA Usaku <usa@ruby-lang.org>2021-06-02 01:40:08 +0900
commit87d02eacd26d0b2884016315baf2440d100f177e (patch)
tree8d99c90890dd198829c5bae7fd02a306c14bc9e8
parent9e0e99023ddef9c0ea80dfc7f0b6924c1be95d03 (diff)
merge revision(s) 9edc162583a4f685332239f6249745ad9b518cbe: [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(-)
-rw-r--r--lib/resolv.rb6
-rw-r--r--version.h6
2 files changed, 6 insertions, 6 deletions
diff --git a/lib/resolv.rb b/lib/resolv.rb
index fd5e475aa23..45b2a9323bf 100644
--- a/lib/resolv.rb
+++ b/lib/resolv.rb
@@ -696,17 +696,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 e825e598823..72bf707852a 100644
--- a/version.h
+++ b/version.h
@@ -2,11 +2,11 @@
# define RUBY_VERSION_MINOR RUBY_API_VERSION_MINOR
#define RUBY_VERSION_TEENY 4
#define RUBY_RELEASE_DATE RUBY_RELEASE_YEAR_STR"-"RUBY_RELEASE_MONTH_STR"-"RUBY_RELEASE_DAY_STR
-#define RUBY_PATCHLEVEL 188
+#define RUBY_PATCHLEVEL 189
#define RUBY_RELEASE_YEAR 2021
-#define RUBY_RELEASE_MONTH 5
-#define RUBY_RELEASE_DAY 31
+#define RUBY_RELEASE_MONTH 6
+#define RUBY_RELEASE_DAY 2
#include "ruby/version.h"