lib/async/http/body/writable.rb in async-http-0.22.0 vs lib/async/http/body/writable.rb in async-http-0.23.0
- old
+ new
@@ -40,10 +40,15 @@
@finished
end
# Read the next available chunk.
def read
+ # I'm not sure if this is a good idea (*).
+ # if @stopped
+ # raise @stopped
+ # end
+
return if @finished
unless chunk = @queue.dequeue
@finished = true
end
@@ -56,9 +61,11 @@
@stopped = error
end
# Write a single chunk to the body. Signal completion by calling `#finish`.
def write(chunk)
+ # If the reader breaks, the writer will break.
+ # The inverse of this is less obvious (*)
if @stopped
raise @stopped
end
# TODO should this yield if the queue is full?