зеркало из https://github.com/github/ruby.git
* lib/rinda/ring.rb (RingFinger#make_socket): Close the socket on exception.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46292 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
f64541d7bd
Коммит
09ab3a0a9f
|
@ -1,3 +1,8 @@
|
|||
Sun Jun 1 11:36:25 2014 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* lib/rinda/ring.rb (RingFinger#make_socket): Close the socket on
|
||||
exception.
|
||||
|
||||
Sun Jun 1 06:55:26 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* parse.y (intern_str): dynamic attrset ID is registered by
|
||||
|
|
|
@ -413,22 +413,26 @@ module Rinda
|
|||
addrinfo = Addrinfo.udp(address, @port)
|
||||
|
||||
soc = Socket.new(addrinfo.pfamily, addrinfo.socktype, addrinfo.protocol)
|
||||
begin
|
||||
if addrinfo.ipv4_multicast? then
|
||||
soc.setsockopt(Socket::Option.ipv4_multicast_loop(1))
|
||||
soc.setsockopt(Socket::Option.ipv4_multicast_ttl(@multicast_hops))
|
||||
elsif addrinfo.ipv6_multicast? then
|
||||
soc.setsockopt(:IPPROTO_IPV6, :IPV6_MULTICAST_LOOP, true)
|
||||
soc.setsockopt(:IPPROTO_IPV6, :IPV6_MULTICAST_HOPS,
|
||||
[@multicast_hops].pack('I'))
|
||||
soc.setsockopt(:IPPROTO_IPV6, :IPV6_MULTICAST_IF,
|
||||
[@multicast_interface].pack('I'))
|
||||
else
|
||||
soc.setsockopt(:SOL_SOCKET, :SO_BROADCAST, true)
|
||||
end
|
||||
|
||||
if addrinfo.ipv4_multicast? then
|
||||
soc.setsockopt(Socket::Option.ipv4_multicast_loop(1))
|
||||
soc.setsockopt(Socket::Option.ipv4_multicast_ttl(@multicast_hops))
|
||||
elsif addrinfo.ipv6_multicast? then
|
||||
soc.setsockopt(:IPPROTO_IPV6, :IPV6_MULTICAST_LOOP, true)
|
||||
soc.setsockopt(:IPPROTO_IPV6, :IPV6_MULTICAST_HOPS,
|
||||
[@multicast_hops].pack('I'))
|
||||
soc.setsockopt(:IPPROTO_IPV6, :IPV6_MULTICAST_IF,
|
||||
[@multicast_interface].pack('I'))
|
||||
else
|
||||
soc.setsockopt(:SOL_SOCKET, :SO_BROADCAST, true)
|
||||
soc.connect(addrinfo)
|
||||
rescue Exception
|
||||
soc.close
|
||||
raise
|
||||
end
|
||||
|
||||
soc.connect(addrinfo)
|
||||
|
||||
soc
|
||||
end
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче