class Bundler::MirrorSockets
用于构建与以下项对应的套接字列表的类
a given mirror.
一个镜像可能对应多个不同的地址,包括
because of it having many dns entries or because the network interface is both ipv4 and ipv5
公共类方法
new(mirror) 点击切换源代码
# File bundler/mirror.rb, line 186 def initialize(mirror) @timeout = mirror.fallback_timeout @addresses = Socket.getaddrinfo(mirror.uri.host, mirror.uri.port).map do |address| SocketAddress.new(address[0], address[3], address[1]) end end
公共实例方法
any?() { |socket, to_socket_address, timeout| ... } 点击切换源代码
# File bundler/mirror.rb, line 193 def any? @addresses.any? do |address| socket = Socket.new(Socket.const_get(address.type), Socket::SOCK_STREAM, 0) socket.setsockopt(Socket::IPPROTO_TCP, Socket::TCP_NODELAY, 1) value = yield socket, address.to_socket_address, @timeout socket.close unless socket.closed? value end end