lib/async/http/body/hijack.rb in async-http-0.46.4 vs lib/async/http/body/hijack.rb in async-http-0.46.5
- old
+ new
@@ -44,10 +44,12 @@
def call(stream)
return @block.call(stream)
end
+ attr :input
+
# Has the producer called #finish and has the reader consumed the nil token?
def empty?
if @stream
@stream.empty?
else
@@ -58,19 +60,25 @@
# Read the next available chunk.
def read
unless @task
@stream = Stream.new(@input)
- @task = Task.current.async do
+ @task = Task.current.async do |task|
+ task.annotate "Streaming hijacked body."
+
@block.call(@stream)
end
end
return @stream.output.read
end
def inspect
"\#<#{self.class} #{@block.inspect}>"
+ end
+
+ def to_s
+ "<Hijack #{@block.class}>"
end
end
end
end
end