about summary refs log tree commit homepage
path: root/lib
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2009-04-09 23:09:03 -0700
committerEric Wong <normalperson@yhbt.net>2009-04-10 10:08:21 -0700
commite83756512c44294137ee3362cf131eed70663fb1 (patch)
tree023fbe95a9390278f13b444c7ddef520c43c9406 /lib
parente26ebc985b882c38da50fb0104791a5f2c0f8522 (diff)
downloadunicorn-e83756512c44294137ee3362cf131eed70663fb1.tar.gz
This fixes a long-standing bug where listeners would be removed
from the known listener set during a reload but never correctly
shut down (until reexec).

Additionally, test_server was working around this bug (my fault,
subconciously) as teardown did not unbind the socket, requiring
the tests to grab a new port.
Diffstat (limited to 'lib')
-rw-r--r--lib/unicorn.rb6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/unicorn.rb b/lib/unicorn.rb
index f8e0a5d..6b50319 100644
--- a/lib/unicorn.rb
+++ b/lib/unicorn.rb
@@ -110,8 +110,10 @@ module Unicorn
 
       @listeners.delete_if do |io|
         if dead_names.include?(sock_name(io))
-          @io_purgatory.delete_if { |pio| pio.fileno == io.fileno }
-          true
+          @io_purgatory.delete_if do |pio|
+            pio.fileno == io.fileno && (pio.close rescue nil).nil?
+          end
+          (io.close rescue nil).nil?
         else
           false
         end