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?.
- #http1? ⇒ Boolean
- #http2? ⇒ Boolean
- #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.
85 86 87 |
# File 'lib/async/http/protocol/http2/connection.rb', line 85 def count @count end |
#promises ⇒ Object (readonly)
Returns the value of attribute promises.
79 80 81 |
# File 'lib/async/http/protocol/http2/connection.rb', line 79 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
104 105 106 107 108 109 110 |
# File 'lib/async/http/protocol/http2/connection.rb', line 104 def close Async.logger.debug(self) {"Closing connection"} @reader.stop if @reader super end |
#connected? ⇒ Boolean
Can we use this connection to make requests?
92 93 94 |
# File 'lib/async/http/protocol/http2/connection.rb', line 92 def connected? @stream.connected? end |
#http1? ⇒ Boolean
48 49 50 |
# File 'lib/async/http/protocol/http2/connection.rb', line 48 def http1? false end |
#http2? ⇒ Boolean
52 53 54 |
# File 'lib/async/http/protocol/http2/connection.rb', line 52 def http2? true 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
87 88 89 |
# File 'lib/async/http/protocol/http2/connection.rb', line 87 def multiplex @remote_settings.maximum_concurrent_streams end |
#peer ⇒ Object
81 82 83 |
# File 'lib/async/http/protocol/http2/connection.rb', line 81 def peer @stream.io end |
#read_in_background(task: Task.current) ⇒ Object
64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/async/http/protocol/http2/connection.rb', line 64 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
96 97 98 |
# File 'lib/async/http/protocol/http2/connection.rb', line 96 def reusable? !(self.closed? || @stream.closed?) end |
#start_connection ⇒ Object
56 57 58 |
# File 'lib/async/http/protocol/http2/connection.rb', line 56 def start_connection @reader ||= read_in_background end |
#stop_connection(error) ⇒ Object
60 61 62 |
# File 'lib/async/http/protocol/http2/connection.rb', line 60 def stop_connection(error) @reader = nil end |
#version ⇒ Object
100 101 102 |
# File 'lib/async/http/protocol/http2/connection.rb', line 100 def version VERSION end |