mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
rinda/ring.rb (make_socket): do not keep socket on failures
This prevents leaked FD warnings on test/rinda/test_rinda.rb when testing on a machine without multicast support. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57355 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
a34f9c7e9a
commit
22908245ef
1 changed files with 5 additions and 1 deletions
|
@ -135,7 +135,6 @@ module Rinda
|
||||||
|
|
||||||
socket = Socket.new(addrinfo.pfamily, addrinfo.socktype,
|
socket = Socket.new(addrinfo.pfamily, addrinfo.socktype,
|
||||||
addrinfo.protocol)
|
addrinfo.protocol)
|
||||||
@sockets << socket
|
|
||||||
|
|
||||||
if addrinfo.ipv4_multicast? or addrinfo.ipv6_multicast? then
|
if addrinfo.ipv4_multicast? or addrinfo.ipv6_multicast? then
|
||||||
if Socket.const_defined?(:SO_REUSEPORT) then
|
if Socket.const_defined?(:SO_REUSEPORT) then
|
||||||
|
@ -166,6 +165,11 @@ module Rinda
|
||||||
end
|
end
|
||||||
|
|
||||||
socket
|
socket
|
||||||
|
rescue
|
||||||
|
socket = socket.close if socket
|
||||||
|
raise
|
||||||
|
ensure
|
||||||
|
@sockets << socket if socket
|
||||||
end
|
end
|
||||||
|
|
||||||
##
|
##
|
||||||
|
|
Loading…
Add table
Reference in a new issue