about summary refs log tree commit homepage
path: root/lib/yahns
diff options
context:
space:
mode:
Diffstat (limited to 'lib/yahns')
-rw-r--r--lib/yahns/config.rb5
-rw-r--r--lib/yahns/rackup_handler.rb6
-rw-r--r--lib/yahns/server.rb4
3 files changed, 11 insertions, 4 deletions
diff --git a/lib/yahns/config.rb b/lib/yahns/config.rb
index e545d59..bcea0d4 100644
--- a/lib/yahns/config.rb
+++ b/lib/yahns/config.rb
@@ -438,4 +438,9 @@ class Yahns::Config # :nodoc:
 
     @app_ctx.each { |app| app.logger ||= server.logger }
   end
+
+  def register_inherited(name)
+    return unless @config_listeners.empty? && @app_ctx.size == 1
+    @config_listeners[name] = { :yahns_app_ctx => @app_ctx[0] }
+  end
 end
diff --git a/lib/yahns/rackup_handler.rb b/lib/yahns/rackup_handler.rb
index 63ab373..3f217af 100644
--- a/lib/yahns/rackup_handler.rb
+++ b/lib/yahns/rackup_handler.rb
@@ -16,10 +16,10 @@ module Yahns::RackupHandler # :nodoc:
       # fine for most apps, but we have SIGUSR2 restarts to support
       working_directory(Yahns::START[:cwd])
 
-      app(:rack, app) do
+      app(:rack, app) do # Yahns::Config#app
         addr = o[:listen] || "#{o[:Host]||default_host}:#{o[:Port]||8080}"
-        # allow listening to multiple addresses
-        addr.split(',').each { |l| listen(l) }
+        # allow listening to multiple addresses (Yahns::Config#listen)
+        addr.split(',').each { |l| listen(l) } unless addr == 'inherit'
 
         val = o[:client_timeout] and client_timeout(val)
       end
diff --git a/lib/yahns/server.rb b/lib/yahns/server.rb
index 43caae6..efd6f05 100644
--- a/lib/yahns/server.rb
+++ b/lib/yahns/server.rb
@@ -327,7 +327,9 @@ class Yahns::Server # :nodoc:
       opts = sock_opts(io)
       io = server_cast(io, opts)
       set_server_sockopt(io, opts)
-      @logger.info "inherited addr=#{sock_name(io)} fd=#{io.fileno}"
+      name = sock_name(io)
+      @logger.info "inherited addr=#{name} fd=#{io.fileno}"
+      @config.register_inherited(name)
       io
     end