about summary refs log tree commit homepage
path: root/lib/yahns/server.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/yahns/server.rb')
-rw-r--r--lib/yahns/server.rb10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/yahns/server.rb b/lib/yahns/server.rb
index 330bcc8..4adf0c9 100644
--- a/lib/yahns/server.rb
+++ b/lib/yahns/server.rb
@@ -359,9 +359,12 @@ class Yahns::Server # :nodoc:
     @listeners.each do |l|
       opts = sock_opts(l)
       ctx = opts[:yahns_app_ctx]
+      ctx_list = opts[:yahns_app_ctx_list] ||= []
       qegg = ctx.qegg || @config.qeggs[:default]
       ctx.queue = queues[qegg] ||= qegg_vivify(qegg, fdmap)
-
+      ctx = ctx.dup
+      ctx.__send__(:include, l.expire_mod)
+      ctx_list << ctx
       # acceptors feed the the queues
       l.spawn_acceptor(opts[:threads] || 1, @logger, ctx)
     end
@@ -379,8 +382,9 @@ class Yahns::Server # :nodoc:
     drop_acceptors # stop acceptors, we close epolls in quit_done
     exit(0) unless alive # drop connections immediately if signaled twice
     @config.config_listeners.each_value do |opts|
-      ctx = opts[:yahns_app_ctx] or next
-      ctx.persistent_connections = false # Yahns::HttpContext
+      list= opts[:yahns_app_ctx_list] or next
+      # Yahns::HttpContext#persistent_connections=
+      list.each { |ctx| ctx.persistent_connections = false }
     end
     false
   end