diff options
author | shirosaki <shirosaki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-06-24 13:39:17 +0000 |
---|---|---|
committer | shirosaki <shirosaki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-06-24 13:39:17 +0000 |
commit | 66ee8a17852bb7657712afd3ac088a8b9b293d71 (patch) | |
tree | 3e4ee1b438e7f64b4929438e0ef3163b843dec53 /test/rinda | |
parent | a75e4aef9ae3ea2cb01109e47c5be311a273fe21 (diff) |
test_rinda.rb: fix for unimplemented ifindex()
* test/rinda/test_rinda.rb (RingIPv6#prepare_ipv6):
ifindex() function may not be implemented on Windows. We use another
check for the case.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41602 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/rinda')
-rw-r--r-- | test/rinda/test_rinda.rb | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/test/rinda/test_rinda.rb b/test/rinda/test_rinda.rb index 570b6e21b8..25288d4b66 100644 --- a/test/rinda/test_rinda.rb +++ b/test/rinda/test_rinda.rb @@ -527,12 +527,18 @@ end module RingIPv6 def prepare_ipv6(r) - Socket.getifaddrs.each do |ifaddr| - next unless ifaddr.addr - next unless ifaddr.addr.ipv6_linklocal? - next if ifaddr.name[0, 2] == "lo" - r.multicast_interface = ifaddr.ifindex - return + begin + Socket.getifaddrs.each do |ifaddr| + next unless ifaddr.addr + next unless ifaddr.addr.ipv6_linklocal? + next if ifaddr.name[0, 2] == "lo" + r.multicast_interface = ifaddr.ifindex + return + end + rescue NotImplementedError + # ifindex() function may not be implemented on Windows. + return if + Socket.ip_address_list.any? { |addrinfo| addrinfo.ipv6? } end skip 'IPv6 not available' end |