Issue #4788 has been updated by Makoto Kishimoto.


???????????lib/resolv.rb ??????TCP ?????????????????対??????????????????
make_requester --> make_udp_requester ??????????????????????????????????????
????????????????????????????????????????????????????????????????????
??????????????????

????????????make_requester ????????????????常?????????????????????????
rubydns ????????????????????????????????????DNS#each_resource
????????中????????????????????????????????????????????????????????
???????????????DNS ????????????????????????????????each_resource ????????中??
????????????????????? duplicate ???????????????????????????????????????
???????????????????????

???????????示????????????????????????????????????????????????????種?????????????
?????? extract_resources ??????????????????????????????????象?????????
?????????????????????????????????? duplicate ???????????????????

???????????追???????????? fetch_resource ???????????????????????
???????????????????????????????????????????????示?????????

--- resolv.rb.orig	2011-05-27 18:15:59.000000000 +0900
+++ resolv.rb	2011-08-03 10:38:43.000000000 +0900
@@ -24,6 +24,13 @@
 		# This allows such responses to be passed upstream with little or no
 		# modification/reinterpretation.
 		def query(name, typeclass)
+			if respond_to?(:fetch_resource) then
+				fetch_resource(name, typeclass) do |reply, reply_name|
+					return reply, reply_name
+				end
+				return
+			end
+
 			lazy_initialize
 			requester = make_requester
 			senders = {}
----------------------------------------
Feature #4788: resolv.rb refactoring
http://redmine.ruby-lang.org/issues/4788

Author: Makoto Kishimoto
Status: Open
Priority: Normal
Assignee: Akira Tanaka
Category: lib
Target version: 1.9.x


??????????????????????????????????????????????????????
https://github.com/ioquatix/rubydns/blob/master/lib/rubydns/resolv.rb
#3835 ? [ruby-core:32407] ????????????????????????????????????????????????????????????????????
?????????resolv.rb??以???????????????????????????????????????????????????????????????
????????????添????????????

----

diff --git a/lib/resolv.rb b/lib/resolv.rb
index 1e18893..e9c2432 100644
--- a/lib/resolv.rb
+++ b/lib/resolv.rb
@@ -491,6 +491,12 @@ class Resolv
     # #getresource for argument details.

     def each_resource(name, typeclass, &proc)
+      each_resource_(name, typeclass) {|reply, reply_name|
+        extract_resources(reply, reply_name, typeclass, &proc)
+      }
+    end
+
+    def each_resource_(name, typeclass)
       lazy_initialize
       requester = make_udp_requester
       senders = {}
@@ -517,7 +523,7 @@ class Resolv
               # response will not fit in an untruncated UDP packet.
               redo
             else
-              extract_resources(reply, reply_name, typeclass, &proc)
+              yield(reply, reply_name)
             end
             return
           when RCode::NXDomain



-- 
http://redmine.ruby-lang.org