1 # -*- encoding: binary -*-
4 module Rainbows::XEpoll::Client
6 Rainbows::Epoll.nr_clients = lambda { N[0] }
7 include Rainbows::Epoll::Client
8 MAX = Rainbows.server.worker_connections
10 EP = Rainbows::Epoll::EP
11 THREADS = Rainbows::HttpServer::LISTENERS.map do |sock|
12 Thread.new(sock) do |sock|
15 if io = sock.kgio_accept
19 sleep while N[0] >= MAX
21 Rainbows::Error.listen_loop(e)
22 end while Rainbows.alive
27 THREADS.each { |t| t.run }
29 Rainbows::JoinThreads.acceptors(THREADS)
34 @wr_queue = [] # may contain String, ResponsePipe, and StreamFile objects
36 EP.set(self, IN) # wake up the main thread
38 Rainbows::Error.write(self, e)
43 N.decr(0, 1) == THRESH and THREADS.each { |t| t.run }