Module: HTTPX::Plugins::FiberConcurrency::HTTP2Methods
- Defined in:
- lib/httpx/plugins/fiber_concurrency.rb,
sig/plugins/fiber_concurrency.rbs
Instance Method Summary collapse
- #add_to_context(request) ⇒ void
- #clear_from_context(request) ⇒ void
- #initialize ⇒ Object
- #interests ⇒ Object
- #send(request) ⇒ Object
Instance Method Details
#add_to_context(request) ⇒ void
This method returns an undefined value.
188 189 190 |
# File 'lib/httpx/plugins/fiber_concurrency.rb', line 188 def add_to_context(request) @contexts[request.context] << request end |
#clear_from_context(request) ⇒ void
This method returns an undefined value.
192 193 194 195 196 197 198 |
# File 'lib/httpx/plugins/fiber_concurrency.rb', line 192 def clear_from_context(request) requests = @contexts[request.context] requests.delete(request) @contexts.delete(request.context) if requests.empty? end |
#initialize ⇒ Object
138 139 140 141 |
# File 'lib/httpx/plugins/fiber_concurrency.rb', line 138 def initialize(*) super @contexts = Hash.new { |hs, k| hs[k] = Set.new } end |
#interests ⇒ Object
143 144 145 146 147 148 149 150 151 |
# File 'lib/httpx/plugins/fiber_concurrency.rb', line 143 def interests if @connection.state == :connected && @handshake_completed && !@contexts.key?(Fiber.current) return :w unless @pings.empty? return end super end |
#send(request) ⇒ Object
153 154 155 156 157 |
# File 'lib/httpx/plugins/fiber_concurrency.rb', line 153 def send(request, *) add_to_context(request) super end |