Skip to content

Conversation

@midnight-wonderer
Copy link
Contributor

Overview

This addresses #739.

Happy Eyeballs landed in Ruby for quite some time. 🎉
https://bugs.ruby-lang.org/issues/20108

However, it does not reach HTTP.rb yet.
This is because HTTP.rb uses TCPSocket.open by default.

Source traces

A baby step

In order to take advantage of the new feature. I alias default_socket_class to Socket.tcp so the connection logic will be handled by the Ruby layer of Socket.

Rough edges

For your information Socket.tcp has a lot of features beyond Happy Eyeballs.
For example, it supports connect_timeout natively.
What to do with

::Timeout.timeout(@time_left, ConnectTimeoutError) do
needs more discussions.
This is just one aspect of it.

Nevertheless, this baby step would introduce minimal breaking changes. (or any changes at all)
Providing more robust connections.

@midnight-wonderer
Copy link
Contributor Author

midnight-wonderer commented Jan 29, 2025

Landed on TCPSocket in Ruby 3.4 (README).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant