Module: Async::HTTP::Protocol::HTTP2::Connection
Instance Attribute Summary collapse
-
#count ⇒ Object
readonly
Returns the value of attribute count.
-
#promises ⇒ Object
readonly
Returns the value of attribute promises.
-
#stream ⇒ Object
readonly
Returns the value of attribute stream.
Instance Method Summary collapse
- #close ⇒ Object
-
#connected? ⇒ Boolean
Can we use this connection to make requests?.
- #initialize ⇒ Object
- #multiplex ⇒ Object
- #peer ⇒ Object
- #read_in_background(task: Task.current) ⇒ Object
- #reusable? ⇒ Boolean
- #start_connection ⇒ Object
- #stop_connection(error) ⇒ Object
- #version ⇒ Object
Instance Attribute Details
#count ⇒ Object (readonly)
Returns the value of attribute count.
77 78 79 |
# File 'lib/async/http/protocol/http2/connection.rb', line 77 def count @count end |
#promises ⇒ Object (readonly)
Returns the value of attribute promises.
71 72 73 |
# File 'lib/async/http/protocol/http2/connection.rb', line 71 def promises @promises end |
#stream ⇒ Object (readonly)
Returns the value of attribute stream.
46 47 48 |
# File 'lib/async/http/protocol/http2/connection.rb', line 46 def stream @stream end |
Instance Method Details
#close ⇒ Object
96 97 98 99 100 101 |
# File 'lib/async/http/protocol/http2/connection.rb', line 96 def close Async.logger.debug(self) {"Closing connection"} @reader.stop if @reader @stream.close end |
#connected? ⇒ Boolean
Can we use this connection to make requests?
84 85 86 |
# File 'lib/async/http/protocol/http2/connection.rb', line 84 def connected? @stream.connected? end |
#initialize ⇒ Object
39 40 41 42 43 44 |
# File 'lib/async/http/protocol/http2/connection.rb', line 39 def initialize(*) super @count = 0 @reader = nil end |
#multiplex ⇒ Object
79 80 81 |
# File 'lib/async/http/protocol/http2/connection.rb', line 79 def multiplex @remote_settings.maximum_concurrent_streams end |
#peer ⇒ Object
73 74 75 |
# File 'lib/async/http/protocol/http2/connection.rb', line 73 def peer @stream.io end |
#read_in_background(task: Task.current) ⇒ Object
56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/async/http/protocol/http2/connection.rb', line 56 def read_in_background(task: Task.current) task.async do |nested_task| nested_task.annotate("#{version} reading data for #{self.class}") begin # Even thought the connection might be logically closed, we are not done until all HTTP/2 streams are closed or the underlying I/O is closed. while !@stream.closed? self.read_frame end ensure stop_connection($!) end end end |
#reusable? ⇒ Boolean
88 89 90 |
# File 'lib/async/http/protocol/http2/connection.rb', line 88 def reusable? !(self.closed? || @stream.closed?) end |
#start_connection ⇒ Object
48 49 50 |
# File 'lib/async/http/protocol/http2/connection.rb', line 48 def start_connection @reader ||= read_in_background end |
#stop_connection(error) ⇒ Object
52 53 54 |
# File 'lib/async/http/protocol/http2/connection.rb', line 52 def stop_connection(error) @reader = nil end |
#version ⇒ Object
92 93 94 |
# File 'lib/async/http/protocol/http2/connection.rb', line 92 def version VERSION end |