Project

General

Profile

Bug #8159 » 0001-Fix-multicast-of-rinda.patch

h.shirosaki (Hiroshi Shirosaki), 04/06/2013 06:15 PM

View differences:

lib/rinda/ring.rb
@renewer = Renewer.new
@ts = ts
@sockets = addresses.map do |address|
@sockets = []
addresses.each do |address|
make_socket(address)
end
......
end
if addrinfo.ipv4_multicast? then
socket.bind(Addrinfo.udp(Socket::INADDR_ANY, @port))
mreq = IPAddr.new(addrinfo.ip_address).hton +
IPAddr.new('0.0.0.0').hton
socket.setsockopt(:IPPROTO_IP, :IP_ADD_MEMBERSHIP, mreq)
else
socket.bind(Addrinfo.udp(nil, @port))
mreq = IPAddr.new(addrinfo.ip_address).hton + [0].pack('I')
socket.setsockopt(:IPPROTO_IPV6, :IPV6_JOIN_GROUP, mreq)
end
else
socket.bind(addrinfo)
end
socket.bind(addrinfo)
@sockets << socket
socket
end
test/rinda/test_rinda.rb
assert(v4mc.getsockopt(:SOCKET, :SO_REUSEADDR).bool)
end
assert_equal('239.0.0.1', v4mc.local_address.ip_address)
assert_equal(@port, v4mc.local_address.ip_port)
assert_equal('0.0.0.0', v4mc.local_address.ip_address)
assert_equal(@port, v4mc.local_address.ip_port)
end
def test_make_socket_ipv6_multicast
......
assert v6mc.getsockopt(:SOCKET, :SO_REUSEADDR).bool
end
assert_equal('ff02::1', v6mc.local_address.ip_address)
assert_equal('::1', v6mc.local_address.ip_address)
assert_equal(@port, v6mc.local_address.ip_port)
end
(1-1/2)