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

[#2127]remove regex match for remote address resolution #1153

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

@asolntsev asolntsev self-assigned this May 26, 2017
@asolntsev
Copy link
Contributor

@flybyray If I am not mistaken, expression InetAddress.getByAddress(address).getHostAddress() can be very slow (depending on network configuration). Because it tries to resolve host name and accesses DNS server. Am I right?

@flybyray
Copy link
Contributor Author

I'm afraid you're wrong.
"The InetAddress class has a cache to store successful as well as unsuccessful host name resolutions."
https://docs.oracle.com/javase/7/docs/api/

"This method doesn't block, i.e. no reverse name service lookup is performed."
https://docs.oracle.com/javase/7/docs/api/java/net/InetAddress.html#getByAddress(byte[])

"the raw IP address in a string format."
https://docs.oracle.com/javase/7/docs/api/java/net/InetAddress.html#getHostAddress()

this is carefully choosen and should have already the code for a long time, all those regex here was totally wrong from the beginning.

if you really care about a hostname lookup you should really call something like getCanonicalHostName
https://docs.oracle.com/javase/7/docs/api/java/net/InetAddress.html#getCanonicalHostName()

@flybyray
Copy link
Contributor Author

but i think about the truncated ip6 scope "%" in old code.
the new code also truncates it because of raw addr .
But maybe a scope_iface or scope_id should be left as is with ip6

@flybyray
Copy link
Contributor Author

@asolntsev from my understanding removing an existing scope is not ideal for someone who has two network interface controllers https://superuser.com/a/99753/587170
maybe with some special setup requests will not answered to local-link connections.
but i think it can be ommited because we handle (PlayHandler) only tcp and a connection is already held open, which follows its own logic to return the response.

@asolntsev
Copy link
Contributor

@flybyray Can you resolve conflicts with master branch?

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.

2 participants