From 38141ffdd3bda01dabfdd8ff8f065c783053c86a Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Fri, 20 Feb 2009 19:55:10 -0800 Subject: revamp configuration with Configurator DSL 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 --- lib/unicorn/socket.rb | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'lib/unicorn/socket.rb') 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 -- cgit v1.2.3-24-ge0c7