Spec-Zone.ru › Ruby 2.7

класс Bundler::Settings::TCPSocketProbe

Родитель:
Object

Class используется для проверки доступности TCP для заданного зеркала.

Публичные методы экземпляра

replies?(mirror) Показать исходный код
# 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

Приватные методы экземпляра

probe_writtable_socket(socket, address) Показать исходный код
# File lib/bundler/mirror.rb, line 171
def probe_writtable_socket(socket, address)
  socket.connect_nonblock(address)
rescue Errno::EISCONN
  true
rescue StandardError # Connection failed
  false
end
wait_for_writtable_socket(socket, address, timeout) Показать исходный код
# File lib/bundler/mirror.rb, line 163
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

Ruby Core © 1993–2017 Yukihiro Matsumoto
Licensed under the Ruby License.
Ruby Standard Library © contributors
Licensed under their own licenses.

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API