Fix: UnknownHostException in cinterop command. (#2271)

This commit is contained in:
Dmitriy Dolovov
2018-10-29 14:53:14 +07:00
committed by GitHub
parent 0681c6ce5f
commit 79e595bf0a
@@ -289,17 +289,15 @@ internal object InternalServer {
} }
} }
private fun checkAccessible(): Boolean { private fun checkAccessible() = try {
if (!InetAddress.getLocalHost().canonicalHostName.endsWith(".$internalDomain")) { if (!InetAddress.getLocalHost().canonicalHostName.endsWith(".$internalDomain")) {
// Fast path: // Fast path:
return false false
} } else {
try {
InetAddress.getByName(host) InetAddress.getByName(host)
return true true
} catch (e: UnknownHostException) {
return false
} }
} catch (e: UnknownHostException) {
false
} }
} }