1 # -*- encoding: binary -*-
3 module Rainbows::Epoll::Server
5 IN = SleepyPenguin::Epoll::IN | SleepyPenguin::Epoll::ET
6 MAX = Rainbows.server.worker_connections
8 LISTENERS = Rainbows::HttpServer::LISTENERS
15 # rearms all listeners when there's a free slot
17 THRESH == (@@nr -= 1) and LISTENERS.each { |sock| EP.set(sock, IN) }
20 def self.extended(sock)
25 return EP.delete(self) if @@nr >= MAX
26 while io = kgio_tryaccept
28 # there's a chance the client never even sees epoll for simple apps
30 return EP.delete(self) if @@nr >= MAX