Method: HTTPX::Connection::HTTP2#interests

Defined in:
lib/httpx/connection/http2.rb

#interestsObject



56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# File 'lib/httpx/connection/http2.rb', line 56

def interests
  if @connection.state == :closed
    return unless @handshake_completed

    return if @buffer.empty?

    return :w
  end

  unless @connection.state == :connected && @handshake_completed
    return @buffer.empty? ? :r : :rw
  end

  unless @connection.send_buffer.empty?
    return :rw unless @buffer.empty?

    # waiting for WINDOW_UPDATE frames
    return :r
  end

  return :w if !@pending.empty? && can_buffer_more_requests?

  return :w unless @drains.empty?

  if @buffer.empty?
    return if @streams.empty? && @pings.empty?

    :r
  else
    :w
  end
end