Class: Bundler::Settings::TCPSocketProbe

Inherits:
Object
  • Object
show all
Defined in:
lib/bundler/mirror.rb

Overview

Class used for probing TCP availability for a given mirror.

Instance Method Summary collapse

Instance Method Details

#replies?(mirror) ⇒ Boolean

Returns:

  • (Boolean)


149
150
151
152
153
154
155
156
157
158
159
# File 'lib/bundler/mirror.rb', line 149

def replies?(mirror)
  MirrorSockets.new(mirror).any? do |socket, address, timeout|
    begin
      socket.connect_nonblock(address)
    rescue Errno::EINPROGRESS
      wait_for_writtable_socket(socket, address, timeout)
    rescue RuntimeError # Connection failed somehow, again
      false
    end
  end
end