1 # -*- encoding: binary -*-
4 class Rainbows::Revactor::Client
5 autoload :TeeSocket, 'rainbows/revactor/client/tee_socket'
7 Rainbows.keepalive_timeout > 0 and
8 RD_ARGS[:timeout] = Rainbows.keepalive_timeout
11 def initialize(client)
12 @client, @rd_args, @ts = client, [ nil ], nil
13 io = client.instance_variable_get(:@_io)
14 io.fcntl(Fcntl::F_SETFD, Fcntl::FD_CLOEXEC)
15 @kgio_addr = if Revactor::TCP::Socket === client
23 def kgio_read!(nr, buf)
24 buf.replace(@client.read)
32 buf2.replace(@client.read(*@rd_args))
35 def set_input(env, hp)
36 env[RACK_INPUT] = 0 == hp.content_length ?
37 NULL_IO : IC.new(@ts = TeeSocket.new(@client), hp)
41 @client.instance_variable_get(:@_io)
54 self.const_set(:IC, Unicorn::HttpRequest.input_class)
55 include Rainbows::ProcessClient
59 require 'rainbows/revactor/client/methods'