lib/async/http/protocol/http2/stream.rb in async-http-0.34.1 vs lib/async/http/protocol/http2/stream.rb in async-http-0.34.2

- old
+ new

@@ -30,18 +30,23 @@ @delegate = delegate @body = body @remainder = nil + + @task = nil end attr_accessor :delegate attr :body - def send_body(body) - @body = body - - window_updated + def send_body(body, task: Async::Task.current) + # TODO Might need to stop this task when body is cancelled. + @task = task.async do + @body = body + + window_updated + end end def send_chunk maximum_size = self.available_frame_size