1 # -*- encoding: binary -*-
3 class Rainbows::StreamResponseEpoll::Client
4 OUT = SleepyPenguin::Epoll::OUT
6 EP = SleepyPenguin::Epoll.new
7 timeout = Rainbows.server.timeout
10 EP.wait(nil, timeout) { |_,client| client.epoll_run }
13 Rainbows::Error.listen_loop(e)
14 end while Rainbows.alive || N[0] > 0
16 Rainbows.at_quit { thr.join(timeout) }
20 def initialize(io, unwritten)
23 @wr_queue = [ unwritten.dup ]
36 return if @to_io.closed?
37 buf = @wr_queue.shift or return on_write_complete
38 case rv = @to_io.kgio_trywrite(buf)
40 buf = @wr_queue.shift or return on_write_complete
41 when String # retry, socket buffer may grow
44 return @wr_queue.unshift(buf)