ruby-changes:45282
From: normal <ko1@a...>
Date: Tue, 17 Jan 2017 12:32:05 +0900 (JST)
Subject: [ruby-changes:45282] normal:r57355 (trunk): rinda/ring.rb (make_socket): do not keep socket on failures
normal 2017-01-17 12:31:57 +0900 (Tue, 17 Jan 2017) New Revision: 57355 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=57355 Log: 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. Modified files: trunk/lib/rinda/ring.rb Index: lib/rinda/ring.rb =================================================================== --- lib/rinda/ring.rb (revision 57354) +++ lib/rinda/ring.rb (revision 57355) @@ -135,7 +135,6 @@ module Rinda https://github.com/ruby/ruby/blob/trunk/lib/rinda/ring.rb#L135 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 https://github.com/ruby/ruby/blob/trunk/lib/rinda/ring.rb#L165 end socket + rescue + socket = socket.close if socket + raise + ensure + @sockets << socket if socket end ## -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/