1 # -*- encoding: binary -*-
4 RUBY_VERSION =~ %r{\A1\.8} and
5 warn "Coolio and Threads do not mix well under Ruby 1.8"
7 class Rainbows::Coolio::ThreadClient < Rainbows::Coolio::Client
11 @env[RACK_INPUT] = input
12 app_dispatch # must be implemented by subclass
15 # this is only called in the master thread
16 def response_write(response)
17 ev_write_response(*response, @hp.next?)
22 # fails-safe application dispatch, we absolutely cannot
23 # afford to fail or raise an exception (killing the thread)
24 # here because that could cause a deadlock and we'd leak FDs
27 @env[REMOTE_ADDR] = @_io.kgio_addr
28 APP.call(@env.merge!(RACK_DEFAULTS))
30 Rainbows::Error.app(e) # we guarantee this does not raise