Feature #20935
closedAPI for Globally Enabling/Disabling Happy Eyeballs Version 2 in the Socket Class
Description
When introducing Happy Eyeballs Version 2 to Socket.tcp
(https://bugs.ruby-lang.org/issues/20108), it was pointed out that there should be a way to disable this feature (https://bugs.ruby-lang.org/issues/20108#note-7).
To address this, I added fast_fallback: true or false
keyword argument to both Socket.tcp
and TCPSocket.new
.
Additionally, I introduced two singleton methods to the Socket
class: tcp_fast_fallback=
and tcp_fast_fallback
.
These can be used as follows:
Socket.tcp(host, port, fast_fallback: true)
TCPSocket.new(host, port, fast_fallback: true)
# Globally controlling HEv2
Socket.tcp_fast_fallback = true # => true
Socket.tcp_fast_fallback # => true
I apologize for this after the implementation, but I would like to discuss whether adding these APIs is appropriate.
Updated by mame (Yusuke Endoh) 7 days ago
@matz (Yukihiro Matsumoto) approved the new API, and also wanted a configuration to stop happy eyeballs by an environment variable: RUBY_TCP_NO_FAST_FALLBACK=1
.
Updated by shioimm (Misaki Shioi) 5 days ago
- Status changed from Open to Closed
New environment variables added in this PR https://github.com/ruby/ruby/pull/12257 .