1
0
Fork 0
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:
normal 2017-01-17 03:31:57 +00:00
parent a34f9c7e9a
commit 22908245ef

View file

@ -135,7 +135,6 @@ module Rinda
socket = Socket.new(addrinfo.pfamily, addrinfo.socktype,
addrinfo.protocol)
@sockets << socket
if addrinfo.ipv4_multicast? or addrinfo.ipv6_multicast? then
if Socket.const_defined?(:SO_REUSEPORT) then
@ -166,6 +165,11 @@ module Rinda
end
socket
rescue
socket = socket.close if socket
raise
ensure
@sockets << socket if socket
end
##