summaryrefslogtreecommitdiff
path: root/lib/rinda
diff options
context:
space:
mode:
authorshirosaki <shirosaki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-04-25 15:36:33 +0000
committershirosaki <shirosaki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-04-25 15:36:33 +0000
commitb721c38f34ad3200563a4d0ab06bbf6cdaa24a04 (patch)
tree1a9e5d7d86594037ec5f10ea7561c7726841bd9a /lib/rinda
parente9c8509e87dccb22640cf09f3c72f59180429789 (diff)
ring.rb: add a socket to @sockets in make_socket()
* lib/rinda/ring.rb (Rinda::RingServer#initialize): add a socket to @sockets in make_socket() to close sockets on shutdown even if make_socket() is called after initialize. * lib/rinda/ring.rb (Rinda::RingServer#make_socket): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40470 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rinda')
-rw-r--r--lib/rinda/ring.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/rinda/ring.rb b/lib/rinda/ring.rb
index 9b3e273..f6566c9 100644
--- a/lib/rinda/ring.rb
+++ b/lib/rinda/ring.rb
@@ -78,7 +78,8 @@ module Rinda
@renewer = Renewer.new
@ts = ts
- @sockets = addresses.map do |address|
+ @sockets = []
+ addresses.each do |address|
make_socket(address)
end
@@ -94,6 +95,7 @@ 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