Method: Async::HTTP::Protocol::HTTP2::Stream#closed

Defined in:
lib/async/http/protocol/http2/stream.rb

#closed(error) ⇒ Object

When the stream transitions to the closed state, this method is called. There are roughly two ways this can happen:

  • A frame is received which causes this stream to enter the closed state. This method will be invoked from the background reader task.

  • 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



157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
# File 'lib/async/http/protocol/http2/stream.rb', line 157

def closed(error)
  super
  
  if input = @input
    @input = nil
    input.close_write(error)
  end
  
  if output = @output
    @output = nil
    output.stop(error)
  end
  
  if pool = @pool and @connection
    pool.release(@connection)
  end
  
  return self
end