Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make happy eyeballs algorithm (IPv6) the default, add new happy_eyeballs option to Connector #224

Merged
merged 3 commits into from
Mar 8, 2020

Conversation

clue
Copy link
Member

@clue clue commented Mar 7, 2020

The Connector class now defaults to using the
happy eyeballs algorithm to
automatically connect over IPv4 or IPv6 when a hostname is given.
This automatically attempts to connect using both IPv4 and IPv6 at the same time
(preferring IPv6), thus avoiding the usual problems faced by users with imperfect
IPv6 connections or setups.
If you want to revert to the old behavior of only doing an IPv4 lookup and
only attempt a single IPv4 connection, you can set up the Connector like this:

$connector = new React\Socket\Connector($loop, array(
    'happy_eyeballs' => false
));

Supersedes / closes #216, thanks @WyriHaximus for the original version. On top of this, I've resolved a garbage reference in legacy PHP by avoiding some unneeded promise wrapping and simplifying this logic slightly.

@clue clue added this to the v1.4.0 milestone Mar 7, 2020
tests/FunctionalConnectorTest.php Outdated Show resolved Hide resolved
@clue clue changed the title Make happy eyeballs algorithm (IPv6) the default, add new happy_eyeballs option Make happy eyeballs algorithm (IPv6) the default, add new happy_eyeballs option to Connector Mar 7, 2020
@clue
Copy link
Member Author

clue commented Mar 7, 2020

@CharlotteDunois @WyriHaximus I agree with what you're saying. These changes had been cherry-picked from #216 without modification, I've just updated this to skip the affected tests instead and improved some of the test timeouts to avoid some sporadic false negatives 👍

@clue clue requested review from WyriHaximus and jsor March 7, 2020 16:07
Copy link
Member

@WyriHaximus WyriHaximus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚢 🇮🇹

@clue
Copy link
Member Author

clue commented Mar 8, 2020

Updated slightly to fix a minor documentation typo :shipit:

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

Successfully merging this pull request may close these issues.

None yet

3 participants