about summary refs log tree commit homepage
path: root/lib/unicorn/http_server.rb
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2013-10-25 19:45:15 +0000
committerEric Wong <normalperson@yhbt.net>2013-10-25 20:00:41 +0000
commite025cd99beee500f175a3bcc302a1307b39ffb77 (patch)
treedb0db4fc4f8224d98681f76a0bf8c99eaa4d284d /lib/unicorn/http_server.rb
parent7c125886b5862bf20711bae22e6697ad46141434 (diff)
downloadunicorn-e025cd99beee500f175a3bcc302a1307b39ffb77.tar.gz
Ruby 1.9 and later includes IO#autoclose=, so we can use it
and prevent some dead IO objects from hanging around.
Diffstat (limited to 'lib/unicorn/http_server.rb')
-rw-r--r--lib/unicorn/http_server.rb6
1 files changed, 3 insertions, 3 deletions
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