module HTTPX::Plugins::FiberConcurrency::ConnectionMethods

  1. lib/httpx/plugins/fiber_concurrency.rb

Public Instance methods

current_context?()
[show source]
   # File lib/httpx/plugins/fiber_concurrency.rb
67 def current_context?
68   @pending.any?(&:current_context?) || (
69     @sibling && @sibling.pending.any?(&:current_context?)
70   )
71 end
initial_call()
[show source]
   # File lib/httpx/plugins/fiber_concurrency.rb
73 def initial_call
74   return unless current_context?
75 
76   super
77 end
interests()
[show source]
   # File lib/httpx/plugins/fiber_concurrency.rb
79 def interests
80   return if connecting? && @pending.none?(&:current_context?)
81 
82   super
83 end
on_connect_error(e)
[show source]
    # File lib/httpx/plugins/fiber_concurrency.rb
104 def on_connect_error(e)
105   return super unless e.is_a?(IOError) && e.message.include?("stream closed in another thread")
106 
107   # @fiber-switch-guard
108   # sockets closed during fiber scheduler switches are raised in separate fibers than the fiber the
109   # socket may be used in. this check verifies that this is actually about this socket.
110   return unless to_io.closed? && !backlog?
111 
112   super
113 end
on_io_error(e)
[show source]
    # File lib/httpx/plugins/fiber_concurrency.rb
 85 def on_io_error(e)
 86   return super unless e.is_a?(IOError) && e.message.include?("stream closed in another thread")
 87 
 88   # @fiber-switch-guard
 89   # sockets closed during fiber scheduler switches are raised in separate fibers than the fiber the
 90   # socket may be used in. this check verifies that this is actually about this socket.
 91   return unless to_io.closed?
 92 
 93   if @state == :closing
 94     # @fiber-switch-guard
 95     # if the connection is reused across fibers, the socket may have been closed in the other fiber
 96     # and switched here during the process, so continue what it was doing and transition to closed
 97     # via #call.
 98     call
 99   elsif !backlog?
100     super
101   end
102 end