lib/yahns/acceptor.rb in yahns-1.15.0 vs lib/yahns/acceptor.rb in yahns-1.16.0

- old
+ new

@@ -22,11 +22,11 @@ def ac_quit unless defined?(@thrs) # acceptor has not started yet, freshly inherited close return true end - @thrs.each { |t| t[:yahns_quit] = true } + @quit = true return true if __ac_quit_done? @thrs.each do begin # try to connect to kick it out of the blocking accept() syscall @@ -40,14 +40,14 @@ rescue SystemCallError return __ac_quit_done? end def spawn_acceptor(nr, logger, client_class) + @quit = false @thrs = nr.times.map do Thread.new do queue = client_class.queue - t = Thread.current accept_flags = Kgio::SOCK_NONBLOCK | Kgio::SOCK_CLOEXEC qev_flags = client_class.superclass::QEV_FLAGS begin # We want the accept/accept4 syscall to be _blocking_ # so it can distribute work evenly between processes @@ -62,10 +62,10 @@ logger.error("#{e.message}, consider raising open file limits") queue.fdmap.desperate_expire(5) sleep 1 # let other threads do some work rescue => e Yahns::Log.exception(logger, "accept loop", e) - end until t[:yahns_quit] + end until @quit end end end def expire_mod