ruby-changes:31793
From: drbrain <ko1@a...>
Date: Wed, 27 Nov 2013 14:50:26 +0900 (JST)
Subject: [ruby-changes:31793] drbrain:r43872 (trunk): * lib/rinda/ring.rb: Announce RingServer for the same process.
drbrain 2013-11-27 14:50:21 +0900 (Wed, 27 Nov 2013) New Revision: 43872 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=43872 Log: * lib/rinda/ring.rb: Announce RingServer for the same process. [ruby-trunk - Bug #9163] * test/rinda/test_rinda.rb: Tests for the above. Modified files: trunk/ChangeLog trunk/lib/rinda/ring.rb trunk/test/rinda/test_rinda.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 43871) +++ ChangeLog (revision 43872) @@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Wed Nov 27 14:50:02 2013 Eric Hodel <drbrain@s...> + + * lib/rinda/ring.rb: Announce RingServer for the same process. + [ruby-trunk - Bug #9163] + * test/rinda/test_rinda.rb: Tests for the above. + Wed Nov 27 14:37:33 2013 Aman Gupta <ruby@t...> * test/ruby/test_eval.rb (class TestEval): Add test for shared eval Index: lib/rinda/ring.rb =================================================================== --- lib/rinda/ring.rb (revision 43871) +++ lib/rinda/ring.rb (revision 43872) @@ -212,7 +212,7 @@ module Rinda https://github.com/ruby/ruby/blob/trunk/lib/rinda/ring.rb#L212 # address of the local TupleSpace. def do_reply - tuple = @ts.take([:lookup_ring, DRbObject], @renewer) + tuple = @ts.take([:lookup_ring, nil], @renewer) Thread.new { tuple[1].call(@ts) rescue nil} rescue end Index: test/rinda/test_rinda.rb =================================================================== --- test/rinda/test_rinda.rb (revision 43871) +++ test/rinda/test_rinda.rb (revision 43872) @@ -558,6 +558,40 @@ class TestRingServer < Test::Unit::TestC https://github.com/ruby/ruby/blob/trunk/test/rinda/test_rinda.rb#L558 @rs.shutdown end + def test_do_reply + called = nil + + callback = proc { |ts| + called = ts + } + + callback = DRb::DRbObject.new callback + + @ts.write [:lookup_ring, callback] + + @rs.do_reply + + Thread.pass until called + + assert_same @ts, called + end + + def test_do_reply_local + called = nil + + callback = proc { |ts| + called = ts + } + + @ts.write [:lookup_ring, callback] + + @rs.do_reply + + Thread.pass until called + + assert_same @ts, called + end + def test_make_socket_unicast v4 = @rs.make_socket('127.0.0.1') -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/