[#91458] [Ruby trunk Feature#4475] default variable name for parameter — matz@...
Issue #4475 has been updated by matz (Yukihiro Matsumoto).
3 messages
2019/02/07
[ruby-core:91419] [Ruby trunk Feature#15553] Addrinfo.getaddrinfo supports timeout
From:
akr@...
Date:
2019-02-06 09:22:49 UTC
List:
ruby-core #91419
Issue #15553 has been updated by akr (Akira Tanaka).
I'm positive to use getaddrinfo_a if it is available.
However, if getaddrinfo_a is not available and timeout option is not set,
timeout library should not be loaded.
Also, it's welcome to improve resolv.rb.
----------------------------------------
Feature #15553: Addrinfo.getaddrinfo supports timeout
https://bugs.ruby-lang.org/issues/15553#change-76680
* Author: Glass_saga (Masaki Matsushita)
* Status: Open
* Priority: Normal
* Assignee:
* Target version: 2.7
----------------------------------------
Currently, we use Timeout in Net::HTTP and other standard libraries.
lib/net/http.rb
```
945 s = Timeout.timeout(@open_timeout, Net::OpenTimeout) {
946 begin
947 TCPSocket.open(conn_address, conn_port, @local_host, @local_port)
948 rescue => e
949 raise e, "Failed to open TCP connection to " +
950 "#{conn_address}:#{conn_port} (#{e.message})"
951 end
952 }
```
Socket.tcp supports connect_timeout, but Addrinfo.getaddrinfo doesn't support timeout.
We need to use Timeout to wait name resolution.
In this patch, Addrinfo.getaddrinfo support timeout and Socket.tcp accepts resolv_timeout.
It uses getaddrinfo_a(3) if available, otherwise it uses Timeout.
We can avoid thread creation to make a TCP connection if getaddrinfo_a(3) is available.
---Files--------------------------------
patch.diff (13.2 KB)
--
https://bugs.ruby-lang.org/
Unsubscribe: <mailto:[email protected]?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>