Support timeout for Addrinfo

Addrinfo.getaddrinfo and .foreach now accepts :timeout in seconds as
a keyword argument. If getaddrinfo_a(3) is available, the timeout will be
applied for name resolution. Otherwise, it will be ignored.

Socket.tcp accepts :resolv_timeout to use this feature.

This commit is retry of 6382f5cc91.
Test was failed on Solaris machines which don't have "http" in
/etc/services. In this commit, use "ssh" instead.
This commit is contained in:
Masaki Matsushita 2019-09-10 09:57:31 +09:00
parent 3678c37119
commit 0e9d56f5e7
6 changed files with 157 additions and 13 deletions

View file

@ -444,6 +444,7 @@ else
test_func = "socket(0,0,0)"
have_library("nsl", 't_open("", 0, (struct t_info *)NULL)', headers) # SunOS
have_library("socket", "socket(0,0,0)", headers) # SunOS
have_library("anl", 'getaddrinfo_a', headers)
end
if have_func(test_func, headers)
@ -505,6 +506,7 @@ EOF
unless have_func("gethostname((char *)0, 0)", headers)
have_func("uname((struct utsname *)NULL)", headers)
end
have_func("getaddrinfo_a", headers)
ipv6 = false
default_ipv6 = /haiku/ !~ RUBY_PLATFORM