about summary refs log tree commit homepage
path: root/lib
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2009-03-29 22:22:11 -0700
committerEric Wong <normalperson@yhbt.net>2009-03-29 22:28:36 -0700
commitae47e5afc5674c13bdbff3afc887a1505f15bd4f (patch)
treea7e108b0a044785c1868cfdd2c73480a54e9de47 /lib
parent45dc7c2acae82c4699c2678017ae714f032aa8b1 (diff)
downloadunicorn-ae47e5afc5674c13bdbff3afc887a1505f15bd4f.tar.gz
Combining command-line and config file options in a reasonable
manner has and always will be a painful experience.
Diffstat (limited to 'lib')
-rw-r--r--lib/unicorn.rb7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/unicorn.rb b/lib/unicorn.rb
index f99b433..7ffc8a5 100644
--- a/lib/unicorn.rb
+++ b/lib/unicorn.rb
@@ -86,6 +86,9 @@ module Unicorn
       # share the same OS-level file descriptor as the higher-level *Server
       # objects; we need to prevent Socket objects from being garbage-collected
       config_listeners -= listener_names
+      if config_listeners.empty? && @listeners.empty?
+        config_listeners << Unicorn::Const::DEFAULT_LISTEN
+      end
       config_listeners.each { |addr| listen(addr) }
       raise ArgumentError, "no listeners" if @listeners.empty?
       self.pid = @config[:pid]
@@ -133,10 +136,10 @@ module Unicorn
     # add a given address to the +listeners+ set, idempotently
     # Allows workers to add a private, per-process listener via the
     # @after_fork hook.  Very useful for debugging and testing.
-    def listen(address)
+    def listen(address, opt = {}.merge(@listener_opts[address] || {}))
       return if String === address && listener_names.include?(address)
 
-      if io = bind_listen(address, @listener_opts[address] || {})
+      if io = bind_listen(address, opt)
         if Socket == io.class
           @io_purgatory << io
           io = server_cast(io)