[#45341] 非同期割り込みに対する対処案(日本語版) — SASADA Koichi <ko1@...>

 ささだです.

28 messages 2012/03/11
[#45816] Re: 非同期割り込みに対する対処案(日本語版) — SASADA Koichi <ko1@...> 2012/06/25

 ささだです.

[#45817] Re: 非同期割り込みに対する対処案(日本語版) — Tanaka Akira <akr@...> 2012/06/25

2012年6月25日 18:26 SASADA Koichi <ko1@atdot.net>:

[#45819] Re: 非同期割り込みに対する対処案(日本語版) — SASADA Koichi <ko1@...> 2012/06/25

 ささだです.

[#45820] Re: 非同期割り込みに対する対処案(日本語版) — Tanaka Akira <akr@...> 2012/06/25

2012年6月25日 19:39 SASADA Koichi <ko1@atdot.net>:

[#45827] Re: 非同期割り込みに対する対処案(日本語版) — SASADA Koichi <ko1@...> 2012/06/25

(2012/06/25 20:32), Tanaka Akira wrote:

[#45841] Re: 非同期割り込みに対する対処案(日本語版) — Tanaka Akira <akr@...> 2012/06/25

2012年6月26日 3:40 SASADA Koichi <ko1@atdot.net>:

[#45372] Marshal.dumpにおけるインスタンス変数の取り扱いについて — keiju@... (Keiju ISHITSUKA)

けいじゅ@いしつかです.

14 messages 2012/03/16
[#45376] Re: Marshal.dumpにおけるインスタンス変数の取り扱いについて — Yukihiro Matsumoto <matz@...> 2012/03/17

まつもと ゆきひろです

[#45377] Re: Marshal.dumpにおけるインスタンス変数の取り扱いについて — keiju@... (石塚圭樹) 2012/03/17

けいじゅ@いしつかです.

[#45381] Re: Marshal.dumpにおけるインスタンス変数の取り扱いについて — Yukihiro Matsumoto <matz@...> 2012/03/17

まつもと ゆきひろです

[#45399] Re: Marshal.dumpにおけるインスタンス変数の取り扱いについて — keiju@... (石塚圭樹) 2012/03/18

けいじゅ@いしつかです.

[#45412] [ruby-trunk - Feature #6177][Open] array.cのrb_ary_equal()の高速化 — "Glass_saga (Masaki Matsushita)" <glass.saga@...>

13 messages 2012/03/20

[#45471] [ruby-trunk - Bug #6230][Open] [WEBrick] WEBrick::HTTPResponse#body の IO オブジェクトの読み込みに read メソッドを使っているため必要以上にブロックされる — "nobuoka (yu nobuoka)" <nobuoka@...>

7 messages 2012/03/30

[ruby-dev:45454] [ruby-trunk - Feature #4788] resolv.rb refactoring

From: "ioquatix (Samuel Williams)" <samuel@...>
Date: 2012-03-29 01:51:05 UTC
List: ruby-dev #45454
Issue #4788 has been updated by ioquatix (Samuel Williams).


Here is a translation into English for the most recent message from Makoto:

The original problem is that 'lib/resolv.rb' had a fallback to TCP which was broken. There was a patch (#3835) which renamed ‘make_requester' to 'make_udp_requester’. This is not a public interface so the code which depended on it stopped working.

However, the reason why RubyDNS depended on such a method is because the high level interface performs breaks the response up into individual records but we are actually interested in the response in its entirety. This is specifically a problem when creating a DNS proxy where you want to forward requests with minimal changes. Duplicating the code for each_resource was unavoidable in the implementation of RubyDNS.

As in the patch provided by Makoto, code duplication can be reduced by removing the direct connection between each_resource and fetch_resource, and providing a block to be executed per successful response.

A second patch shows how RubyDNS can be simplified once the proposed change is applied.

----------------------------------------
Feature #4788: resolv.rb refactoring
https://bugs.ruby-lang.org/issues/4788#change-25344

Author: metanest (Makoto Kishimoto)
Status: Assigned
Priority: Normal
Assignee: akr (Akira Tanaka)
Category: lib
Target version: 2.0.0


このようなモンキーパッチが(私のコードではありませんが)
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://bugs.ruby-lang.org/

In This Thread