lib/async/http/protocol/http2/stream.rb in async-http-0.78.0 vs lib/async/http/protocol/http2/stream.rb in async-http-0.79.0

- old
+ new

@@ -60,13 +60,13 @@ else self.receive_initial_headers(super, frame.end_stream?) end # TODO this might need to be in an ensure block: - if @input and frame.end_stream? - @input.close_write + if input = @input and frame.end_stream? @input = nil + input.close_write end rescue ::Protocol::HTTP2::HeaderError => error Console.logger.debug(self, error) send_reset_stream(error.code) @@ -121,10 +121,12 @@ @output.start end # Called when the output terminates normally. def finish_output(error = nil) + return if self.closed? + trailer = @output&.trailer @output = nil if error @@ -150,17 +152,17 @@ # - A frame is sent which causes this stream to enter the closed state. This method will be invoked from that task. # While the input stream is relatively straight forward, the output stream can trigger the second case above def closed(error) super - if @input - @input.close_write(error) + if input = @input @input = nil + input.close_write(error) end - if @output - @output.stop(error) + if output = @output @output = nil + output.stop(error) end if pool = @pool and @connection pool.release(@connection) end