Module: HTTPX::Plugins::FiberConcurrency::ConnectionMethods
- Defined in:
- lib/httpx/plugins/fiber_concurrency.rb,
sig/plugins/fiber_concurrency.rbs
Instance Method Summary collapse
-
#backlog? ⇒ Boolean
checks whether the connection has any pending request (which the connection itself may have stored, or it may be somewhere in the parser).
- #current_context? ⇒ Boolean
- #initial_call ⇒ Object
- #interests ⇒ Object
- #on_connect_error(e) ⇒ Object
- #on_io_error(e) ⇒ Object
- #send ⇒ void
Instance Method Details
#backlog? ⇒ Boolean
checks whether the connection has any pending request (which the connection itself may have stored, or it may be somewhere in the parser).
119 120 121 122 |
# File 'lib/httpx/plugins/fiber_concurrency.rb', line 119 def backlog? @pending.any? || (@parser && (@parser.pending.any? || @parser.requests.any?)) end |
#current_context? ⇒ Boolean
67 68 69 70 71 |
# File 'lib/httpx/plugins/fiber_concurrency.rb', line 67 def current_context? @pending.any?(&:current_context?) || ( @sibling && @sibling.pending.any?(&:current_context?) ) end |
#initial_call ⇒ Object
73 74 75 76 77 |
# File 'lib/httpx/plugins/fiber_concurrency.rb', line 73 def initial_call return unless current_context? super end |
#interests ⇒ Object
79 80 81 82 83 |
# File 'lib/httpx/plugins/fiber_concurrency.rb', line 79 def interests return if connecting? && @pending.none?(&:current_context?) super end |
#on_connect_error(e) ⇒ Object
104 105 106 107 108 109 110 111 112 113 |
# File 'lib/httpx/plugins/fiber_concurrency.rb', line 104 def on_connect_error(e) return super unless e.is_a?(IOError) && e..include?("stream closed in another thread") # @fiber-switch-guard # sockets closed during fiber scheduler switches are raised in separate fibers than the fiber the # socket may be used in. this check verifies that this is actually about this socket. return unless to_io.closed? && !backlog? super end |
#on_io_error(e) ⇒ Object
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
# File 'lib/httpx/plugins/fiber_concurrency.rb', line 85 def on_io_error(e) return super unless e.is_a?(IOError) && e..include?("stream closed in another thread") # @fiber-switch-guard # sockets closed during fiber scheduler switches are raised in separate fibers than the fiber the # socket may be used in. this check verifies that this is actually about this socket. return unless to_io.closed? if @state == :closing # @fiber-switch-guard # if the connection is reused across fibers, the socket may have been closed in the other fiber # and switched here during the process, so continue what it was doing and transition to closed # via #call. call elsif !backlog? super end end |
#send ⇒ void
This method returns an undefined value.
19 |
# File 'sig/plugins/fiber_concurrency.rbs', line 19
def send: (request request) -> void
|