Module: Async::HTTP::Protocol::HTTP2::Connection
Instance Attribute Summary collapse
-
#count ⇒ Object
readonly
Returns the value of attribute count.
-
#stream ⇒ Object
readonly
Returns the value of attribute stream.
Instance Method Summary collapse
- #close ⇒ Object
-
#good? ⇒ Boolean
Can we use this connection to make requests?.
- #initialize ⇒ Object
-
#multiplex ⇒ Object
Only one simultaneous connection at a time.
- #peer ⇒ Object
- #read_in_background(task: Task.current) ⇒ Object
- #reusable? ⇒ Boolean
- #start_connection ⇒ Object
- #version ⇒ Object
Instance Attribute Details
#count ⇒ Object (readonly)
Returns the value of attribute count.
68 69 70 |
# File 'lib/async/http/protocol/http2/connection.rb', line 68 def count @count end |
#stream ⇒ Object (readonly)
Returns the value of attribute stream.
44 45 46 |
# File 'lib/async/http/protocol/http2/connection.rb', line 44 def stream @stream end |
Instance Method Details
#close ⇒ Object
88 89 90 91 92 93 |
# File 'lib/async/http/protocol/http2/connection.rb', line 88 def close Async.logger.debug(self) {"Closing connection"} @reader.stop if @reader @stream.close end |
#good? ⇒ Boolean
Can we use this connection to make requests?
76 77 78 |
# File 'lib/async/http/protocol/http2/connection.rb', line 76 def good? @stream.connected? end |
#initialize ⇒ Object
37 38 39 40 41 42 |
# File 'lib/async/http/protocol/http2/connection.rb', line 37 def initialize(*) super @count = 0 @reader = nil end |
#multiplex ⇒ Object
Only one simultaneous connection at a time.
71 72 73 |
# File 'lib/async/http/protocol/http2/connection.rb', line 71 def multiplex @remote_settings.maximum_concurrent_streams end |
#peer ⇒ Object
64 65 66 |
# File 'lib/async/http/protocol/http2/connection.rb', line 64 def peer @stream.io end |
#read_in_background(task: Task.current) ⇒ Object
50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/async/http/protocol/http2/connection.rb', line 50 def read_in_background(task: Task.current) task.async do |nested_task| nested_task.annotate("#{version} reading data") begin while !self.closed? self.read_frame end rescue Async.logger.debug(self) {$!} end end end |
#reusable? ⇒ Boolean
80 81 82 |
# File 'lib/async/http/protocol/http2/connection.rb', line 80 def reusable? !(self.closed? || @stream.closed?) end |
#start_connection ⇒ Object
46 47 48 |
# File 'lib/async/http/protocol/http2/connection.rb', line 46 def start_connection @reader ||= read_in_background end |
#version ⇒ Object
84 85 86 |
# File 'lib/async/http/protocol/http2/connection.rb', line 84 def version VERSION end |