Module: HTTPX::Plugins::FiberConcurrency::HTTP2Methods

Defined in:
lib/httpx/plugins/fiber_concurrency.rb,
sig/plugins/fiber_concurrency.rbs

Instance Method Summary collapse

Instance Method Details

#backlog? ⇒ Boolean

Returns:

  • (Boolean)


194
195
196
# File 'lib/httpx/plugins/fiber_concurrency.rb', line 194

def backlog?
  !no_more_requests?
end

#initialize ⇒ Object



173
174
175
176
# File 'lib/httpx/plugins/fiber_concurrency.rb', line 173

def initialize(*)
  super
  @contexts = Hash.new { |hs, k| hs[k] = Set.new }
end

#interests ⇒ Object



178
179
180
181
182
183
184
185
186
# File 'lib/httpx/plugins/fiber_concurrency.rb', line 178

def interests
  if @connection.state == :connected && @handshake_completed && !@contexts.key?(Fiber.current)
    return :w unless @pings.empty?

    return
  end

  super
end

#no_requests_to_handle? ⇒ Boolean

Returns:

  • (Boolean)


198
199
200
# File 'lib/httpx/plugins/fiber_concurrency.rb', line 198

def no_requests_to_handle?
  @streams.each_key.none?(&:current_context?)
end

#send(request) ⇒ Object



188
189
190
191
192
# File 'lib/httpx/plugins/fiber_concurrency.rb', line 188

def send(request, *)
  add_to_context(request)

  super
end