Constants
No documentation available
No documentation available
Class Methods
ext/socket/lib/socket.rb
View on GitHub
# File tmp/rubies/ruby-master/ext/socket/lib/socket.rb, line 1018
def initialize(family_names)
@family_names = family_names
@addrinfo_dict = {}
@error_dict = {}
@last_family = nil
end
No documentation available
Instance Methods
ext/socket/lib/socket.rb
View on GitHub
# File tmp/rubies/ruby-master/ext/socket/lib/socket.rb, line 1029
def add_error(family_name, error)
@addrinfo_dict[family_name] = []
@error_dict[family_name] = error
end
No documentation available
ext/socket/lib/socket.rb
View on GitHub
# File tmp/rubies/ruby-master/ext/socket/lib/socket.rb, line 1025
def add_resolved(family_name, addrinfos)
@addrinfo_dict[family_name] = addrinfos
end
No documentation available
ext/socket/lib/socket.rb
View on GitHub
# File tmp/rubies/ruby-master/ext/socket/lib/socket.rb, line 1056
def any_addrinfos?
!empty_addrinfos?
end
No documentation available
ext/socket/lib/socket.rb
View on GitHub
# File tmp/rubies/ruby-master/ext/socket/lib/socket.rb, line 1072
def any_unresolved_family?
!resolved_all_families?
end
No documentation available
ext/socket/lib/socket.rb
View on GitHub
# File tmp/rubies/ruby-master/ext/socket/lib/socket.rb, line 1052
def empty_addrinfos?
@addrinfo_dict.all? { |_, addrinfos| addrinfos.empty? }
end
No documentation available
ext/socket/lib/socket.rb
View on GitHub
# File tmp/rubies/ruby-master/ext/socket/lib/socket.rb, line 1034
def get_addrinfo
precedences =
case @last_family
when :ipv4, nil then PRIORITY_ON_V6
when :ipv6 then PRIORITY_ON_V4
end
precedences.each do |family_name|
addrinfo = @addrinfo_dict[family_name]&.shift
next unless addrinfo
@last_family = family_name
return addrinfo
end
nil
end
No documentation available
ext/socket/lib/socket.rb
View on GitHub
# File tmp/rubies/ruby-master/ext/socket/lib/socket.rb, line 1060
def resolved?(family)
@addrinfo_dict.has_key? family
end
No documentation available
ext/socket/lib/socket.rb
View on GitHub
# File tmp/rubies/ruby-master/ext/socket/lib/socket.rb, line 1068
def resolved_all_families?
(@family_names - @addrinfo_dict.keys).empty?
end
No documentation available
ext/socket/lib/socket.rb
View on GitHub
# File tmp/rubies/ruby-master/ext/socket/lib/socket.rb, line 1064
def resolved_successfully?(family)
resolved?(family) && !!@error_dict[family]
end
No documentation available