-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
Fix connect socket InetSocketAddress #3597
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## master #3597 +/- ##
============================================
- Coverage 71.50% 71.46% -0.04%
+ Complexity 4851 4847 -4
============================================
Files 288 288
Lines 15461 15461
Branches 1095 1095
============================================
- Hits 11055 11049 -6
- Misses 3930 3934 +4
- Partials 476 478 +2
☔ View full report in Codecov by Sentry. |
@yangbodong22011 The code makes sense. But to make sure your reasoning, do you understand that due to List<InetAddress> hosts = Arrays.asList(InetAddress.getAllByName(hostAndPort.getHost()));
if (hosts.size() > 1) {
Collections.shuffle(hosts);
} you can't ensure ipv4 comes before ipv6? |
Yes, I noticed the shuffle. My scenario is that startNode is localhost, and two During the subsequent connection process, if it is an ipv6 address, after socket.connect, an error "Unexpected end of stream." will be reported when performing read. Because of the old code, the ipv6 address will still perform |
@yangbodong22011 I'm not sure. This change was not necessary until #3596. |
Resolved in #3596 |
Passing
host
directly will avoid another call toInetAddress.getByName
inside theInetSocketAddress
function.For machines with ipv4 and ipv6, but the startNode uses ipv4 to connect, the ipv6 connection may fail.