diff options
Diffstat (limited to 'lib/yahns/server.rb')
-rw-r--r-- | lib/yahns/server.rb | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/lib/yahns/server.rb b/lib/yahns/server.rb index c7a5a57..e8f1213 100644 --- a/lib/yahns/server.rb +++ b/lib/yahns/server.rb @@ -292,14 +292,22 @@ class Yahns::Server # :nodoc: @logger.info "#{prefix}done reopening logs" end + def quit_enter(alive) + self.listeners = [] + 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 + end + false + end + def sp_sig_handle(alive) @sev.kgio_wait_readable(alive ? nil : 0.01) @sev.yahns_step case sig = @sig_queue.shift when :QUIT, :TERM, :INT - self.listeners = [] # stop accepting new connections - exit(0) unless alive - return false + return quit_enter(alive) when :USR1 usr1_reopen('') when :USR2 |