about summary refs log tree commit homepage
path: root/lib/unicorn/socket.rb
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2009-02-20 19:55:10 -0800
committerEric Wong <normalperson@yhbt.net>2009-02-21 04:23:37 -0800
commit38141ffdd3bda01dabfdd8ff8f065c783053c86a (patch)
tree1d05740ef1520111a2fb5ee7852b7f6e091c2d60 /lib/unicorn/socket.rb
parentb8697b5fb102049f341e710204dfafeecfedc308 (diff)
downloadunicorn-38141ffdd3bda01dabfdd8ff8f065c783053c86a.tar.gz
The Configurator includes error checking and opens the way for
better reloading/error-checking abilities.

This also renames many of the config settings with something
nginx-like to minimize the learning/setup curve since nginx is
the only recommended reverse-proxy for this.

s/pid_file/pid/
  => blech!, more confusing :<

s/listen_backlog/backlog/
  => maybe more confusing to some, or less...

s/nr_workers/worker_processes/
  => less confusing to non-AWKers for sure

s/hot_config_file/config_file/
  => the config file is now general purpose,
     not just hot reloads
Diffstat (limited to 'lib/unicorn/socket.rb')
-rw-r--r--lib/unicorn/socket.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/unicorn/socket.rb b/lib/unicorn/socket.rb
index 9519448..4913261 100644
--- a/lib/unicorn/socket.rb
+++ b/lib/unicorn/socket.rb
@@ -62,6 +62,13 @@ module Unicorn
       end
     end
 
+    def destroy_safely(io)
+      if io.respond_to?(:path) && File.stat(io.path).ino == io.stat.ino
+        File.unlink(io.path) rescue nil
+      end
+      io.close rescue nil
+    end
+
     # creates a new server, socket. address may be a HOST:PORT or
     # an absolute path to a UNIX socket.  address can even be a Socket
     # object in which case it is immediately returned