class Falcon::Adapters::Hijack

This is used for implementing partial hijack.

def self.for(env, block, socket = nil, task: Async::Task.current)

def self.for(env, block, socket = nil, task: Async::Task.current)
	input = socket || env[Rack::RACK_INPUT]
	output = Async::HTTP::Body::Writable.new
	
	stream = Hijack.new(input, output)
	
	task.async do
		begin
			block.call(stream)
		ensure
			output.close
		end
	end
	
	return output
end

def close

def close
	@output.close
end

def close_read

def close_read
	if @input.respond_to?(:close_read)
		@input.close_read
	else
		@input.close
	end
end

def close_write

def close_write
	@output.close
end

def flush

def flush
end

def initialize(input, output)

def initialize(input, output)
	@input = input
	@output = output
end

def read(length = nil, buffer = nil)

def read(length = nil, buffer = nil)
	@input.read(length, buffer)
end

def read_nonblock(length, buffer = nil)

def read_nonblock(length, buffer = nil)
	@input.read(length, buffer)
end

def write(buffer)

def write(buffer)
	@output.write(buffer)
end