Module: HTTPX::Plugins::H2::ConnectionMethods
- Defined in:
- lib/httpx/plugins/upgrade/h2.rb
Instance Method Summary collapse
Instance Method Details
#upgrade_to_h2 ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/httpx/plugins/upgrade/h2.rb', line 25 def upgrade_to_h2 prev_parser = @parser if prev_parser prev_parser.reset @inflight -= prev_parser.requests.size end @parser = Connection::HTTP2.new(@write_buffer, @options) set_parser_callbacks(@parser) @upgrade_protocol = "h2" # what's happening here: # a deviation from the state machine is done to perform the actions when a # connection is closed, without transitioning, so the connection is kept in the pool. # the state is reset to initial, so that the socket reconnect works out of the box, # while the parser is already here. purge_after_closed transition(:idle) prev_parser.requests.each do |req| req.transition(:idle) send(req) end end |