[前][次][番号順一覧][スレッド一覧]

ruby-changes:66297

From: nagachika <ko1@a...>
Date: Sat, 22 May 2021 15:22:22 +0900 (JST)
Subject: [ruby-changes:66297] 9c0df2e81c (ruby_3_0): merge revision(s) 9edc162583a4f685332239f6249745ad9b518cbe: [Backport #17781]

https://git.ruby-lang.org/ruby.git/commit/?id=9c0df2e81c

From 9c0df2e81c22e6e35f3c5d69a070c2a3cf67e320 Mon Sep 17 00:00:00 2001
From: nagachika <nagachika@r...>
Date: Sat, 22 May 2021 15:20:23 +0900
Subject: 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(-)
---
 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 3ca0f01..b69c704 100644
--- a/lib/resolv.rb
+++ b/lib/resolv.rb
@@ -696,17 +696,17 @@ class Resolv https://github.com/ruby/ruby/blob/trunk/lib/resolv.rb#L696
           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 c45284d..d7083e5 100644
--- a/version.h
+++ b/version.h
@@ -12,7 +12,7 @@ https://github.com/ruby/ruby/blob/trunk/version.h#L12
 # define RUBY_VERSION_MINOR RUBY_API_VERSION_MINOR
 #define RUBY_VERSION_TEENY 2
 #define RUBY_RELEASE_DATE RUBY_RELEASE_YEAR_STR"-"RUBY_RELEASE_MONTH_STR"-"RUBY_RELEASE_DAY_STR
-#define RUBY_PATCHLEVEL 77
+#define RUBY_PATCHLEVEL 78
 
 #define RUBY_RELEASE_YEAR 2021
 #define RUBY_RELEASE_MONTH 5
-- 
cgit v1.1


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]