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

ruby-changes:27856

From: naruse <ko1@a...>
Date: Sun, 24 Mar 2013 23:36:37 +0900 (JST)
Subject: [ruby-changes:27856] naruse:r39908 (trunk): Try interface indexes which can use for IPv6 multicast

naruse	2013-03-24 23:36:26 +0900 (Sun, 24 Mar 2013)

  New Revision: 39908

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=39908

  Log:
    Try interface indexes which can use for IPv6 multicast
    
    a fix for r39896

  Modified files:
    trunk/test/rinda/test_rinda.rb

Index: test/rinda/test_rinda.rb
===================================================================
--- test/rinda/test_rinda.rb	(revision 39907)
+++ test/rinda/test_rinda.rb	(revision 39908)
@@ -580,7 +580,19 @@ class TestRingFinger < Test::Unit::TestC https://github.com/ruby/ruby/blob/trunk/test/rinda/test_rinda.rb#L580
 
   def setup
     @rf = Rinda::RingFinger.new
-    @rf.multicast_interface = 1
+    ifindex = nil
+    10.times do |i|
+      begin
+        addrinfo = Addrinfo.udp('ff02::1', Rinda::Ring_PORT)
+        soc = Socket.new(addrinfo.pfamily, addrinfo.socktype, addrinfo.protocol)
+        soc.setsockopt(:IPPROTO_IPV6, :IPV6_MULTICAST_IF,
+                       [i].pack('I'))
+        ifindex = i
+        break
+      rescue
+      end
+    end
+    @rf.multicast_interface = ifindex
   end
 
   def test_make_socket_unicast

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

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