ci: Re-enable ConnectSingleClient_Hostname test#3950
Open
michalChrobot wants to merge 3 commits intodevelop-2.0.0from
Open
ci: Re-enable ConnectSingleClient_Hostname test#3950michalChrobot wants to merge 3 commits intodevelop-2.0.0from
michalChrobot wants to merge 3 commits intodevelop-2.0.0from
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose of this PR
This PR aims to re-enable ConnectSingleClient_Hostname test for Android platform
Why the test was failing
The test's strategy was: start the client connecting to "localhost", wait one frame, look at GetLocalEndpoint() to see which address family was resolved, then start the server on the matching loopback address (127.0.0.1 for IPv4, ::1 for IPv6).
This strategy breaks on Android with Unity 6000.3+ because localhost is no longer guaranteed to resolve to a loopback address (see HOSTNAME_RESOLUTION_AVAILABLE define usage. This test is passing on previous editors as it's compiled out)
Solution
Poll for resolution completion instead of waiting one frame
GetLocalEndpoint() returns an invalid endpoint until the hostname resolution job runs and the driver binds. One frame was assumed to always be enough, but it seems to not be reliable on all platforms. The fix loops until a valid family is returned, with a 2-second safety timeout.
Listen on the wildcard address instead of a hardcoded loopback
Rather than mapping the resolved family to a specific loopback address (127.0.0.1 / ::1), the server now listens on the wildcard for that family. This means the server accepts connections on any interface of the correct family, regardless of what IP localhost actually resolved to on the device.
Jira ticket
https://jira.unity3d.com/browse/MTT-14757
Documentation
N/A
Testing & QA (How your changes can be verified during release Playtest)
Green pass of this test of jobs like
Backports
N/A, issue related only to NGOv2.X as 1.X doesn't support editors of 6000.3+ (which are affected)