Module: HTTPX::Plugins::FiberConcurrency::ConnectionMethods
- Defined in:
- lib/httpx/plugins/fiber_concurrency.rb
Instance Method Summary collapse
- #current_context? ⇒ Boolean
- #interests ⇒ Object
- #on_connect_error(e) ⇒ Object
- #on_io_error(e) ⇒ Object
Instance Method Details
#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 |
#interests ⇒ Object
73 74 75 76 77 |
# File 'lib/httpx/plugins/fiber_concurrency.rb', line 73 def interests return if connecting? && @pending.none?(&:current_context?) super end |
#on_connect_error(e) ⇒ Object
98 99 100 101 102 103 104 105 106 107 |
# File 'lib/httpx/plugins/fiber_concurrency.rb', line 98 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
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'lib/httpx/plugins/fiber_concurrency.rb', line 79 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 |