Schedule

Misaki Shioi
Misaki Shioi
  • @coe401_

Rails application developer. Rubyist. Member of Asakusa.rb.

Making TCPSocket.new "Happy"!

I introduced Happy Eyeballs Version 2 (RFC8305) (hereafter HEv2) into the socket library's Socket.tcp and TCPSocket.new. This algorithm addresses the issue of delays that occur when DNS resolution for one address family takes too long, or when one of the candidate IP addresses is unavailable, preventing fallback to other options.

At RubyKaigi 2024, I presented how HEv2 was implemented in Socket.tcp (written in Ruby). And I initially planned to apply the same approach to TCPSocket.new (written in C). However, things did not go as expected, and the work began with reimplementing Socket.tcp itself.

This was a deeply rewarding project—so much so that it turned me, a Rubyist with an interest in networking, into a Ruby committer.

In this presentation, I will revisit HEv2, particularly focusing on TCPSocket.new, and share the journey of how it was implemented, merged, and eventually released as part of Ruby 3.4.