From e025cd99beee500f175a3bcc302a1307b39ffb77 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Fri, 25 Oct 2013 19:45:15 +0000 Subject: avoid IO_PURGATORY on Ruby 1.9+ Ruby 1.9 and later includes IO#autoclose=, so we can use it and prevent some dead IO objects from hanging around. --- lib/unicorn/http_server.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lib/unicorn/http_server.rb') diff --git a/lib/unicorn/http_server.rb b/lib/unicorn/http_server.rb index cd160c5..a6266ea 100644 --- a/lib/unicorn/http_server.rb +++ b/lib/unicorn/http_server.rb @@ -254,7 +254,7 @@ class Unicorn::HttpServer begin io = bind_listen(address, opt) unless Kgio::TCPServer === io || Kgio::UNIXServer === io - IO_PURGATORY << io + prevent_autoclose(io) io = server_cast(io) end logger.info "listening on addr=#{sock_name(io)} fd=#{io.fileno}" @@ -466,7 +466,7 @@ class Unicorn::HttpServer (3..1024).each do |io| next if listener_fds.include?(io) io = IO.for_fd(io) rescue next - IO_PURGATORY << io + prevent_autoclose(io) io.fcntl(Fcntl::F_SETFD, Fcntl::FD_CLOEXEC) end @@ -772,7 +772,7 @@ class Unicorn::HttpServer inherited = ENV['UNICORN_FD'].to_s.split(/,/).map do |fd| io = Socket.for_fd(fd.to_i) set_server_sockopt(io, listener_opts[sock_name(io)]) - IO_PURGATORY << io + prevent_autoclose(io) logger.info "inherited addr=#{sock_name(io)} fd=#{fd}" server_cast(io) end -- cgit v1.2.3-24-ge0c7