Skip to content

core: prefer getHostString() to getHostName() in ProxyDetectorImpl #4165

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

Merged
merged 1 commit into from
Mar 2, 2018

Conversation

ericgribkoff
Copy link
Contributor

Addresses #4154 by using getHostString() instead of getHostName() when its available, to avoid a potential reverse lookup that can execute on the user's calling thread.

For non-Android users, this will avoid the network I/O for anyone using Java 7+. But for Android, getHostString() is only available for Android API levels >= 19 and the fallback to getHostName() can still trigger a NetworkOnMainException.

@ejona86 From a preliminary look, #4137 will address the root cause of #4154, and will apply to all supported Android API levels. If #4137 makes it in the next release, we probably won't need this PR - unless we want to backport a light-weight fix for #4145 to existing releases.

@ericgribkoff ericgribkoff merged commit 3268082 into grpc:master Mar 2, 2018
@lock lock bot locked as resolved and limited conversation to collaborators Jan 18, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants