Project

General

Profile

Bug #9163 ยป rinda.ring.rb.announce_local_ring_server.patch

drbrain (Eric Hodel), 11/27/2013 02:37 PM

View differences:

lib/rinda/ring.rb (working copy)
212 212
    # address of the local TupleSpace.
213 213

  
214 214
    def do_reply
215
      tuple = @ts.take([:lookup_ring, DRbObject], @renewer)
215
      tuple = @ts.take([:lookup_ring, nil], @renewer)
216 216
      Thread.new { tuple[1].call(@ts) rescue nil}
217 217
    rescue
218 218
    end
test/rinda/test_rinda.rb (working copy)
558 558
    @rs.shutdown
559 559
  end
560 560

  
561
  def test_do_reply
562
    called = nil
563

  
564
    callback = proc { |ts|
565
      called = ts
566
    }
567

  
568
    callback = DRb::DRbObject.new callback
569

  
570
    @ts.write [:lookup_ring, callback]
571

  
572
    @rs.do_reply
573

  
574
    Thread.pass until called
575

  
576
    assert_same @ts, called
577
  end
578

  
579
  def test_do_reply_local
580
    called = nil
581

  
582
    callback = proc { |ts|
583
      called = ts
584
    }
585

  
586
    @ts.write [:lookup_ring, callback]
587

  
588
    @rs.do_reply
589

  
590
    Thread.pass until called
591

  
592
    assert_same @ts, called
593
  end
594

  
561 595
  def test_make_socket_unicast
562 596
    v4 = @rs.make_socket('127.0.0.1')
563 597