Skip to content

Conversation

@flybyray
Copy link
Contributor

@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.

@flybyray flybyray force-pushed the lighthouse-2127-patch branch from 14f73cb to 38ca22a Compare July 3, 2017 13:41
@flybyray flybyray force-pushed the lighthouse-2127-patch branch from 38ca22a to 43da33d Compare July 3, 2017 13:42
@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