class Bundler::Settings::TCPSocketProbe
Class used for probing TCP availability for a given mirror.
def probe_writtable_socket(socket, address)
def probe_writtable_socket(socket, address) socket.connect_nonblock(address) rescue Errno::EISCONN true rescue # Connection failed false end
def replies?(mirror)
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 # Connection failed somehow, again false end end end
def wait_for_writtable_socket(socket, address, timeout)
def wait_for_writtable_socket(socket, address, timeout) if IO.select(nil, [socket], nil, timeout) probe_writtable_socket(socket, address) else # TCP Handshake timed out, or there is something dropping packets false end end