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 ]
40 return if @to_io.closed?
41 buf = @wr_queue.shift or return on_write_complete
42 case rv = @to_io.kgio_trywrite(buf)
44 buf = @wr_queue.shift or return on_write_complete
45 when String # retry, socket buffer may grow
48 return @wr_queue.unshift(buf)
60 elsif @finish.respond_to?(:call) # hijacked