diff --git a/ktor-server/ktor-server-cio/jsAndWasmShared/src/io/ktor/server/cio/backend/SocketAddressUtils.jsAndWasmShared.kt b/ktor-server/ktor-server-cio/nonJvm/src/io/ktor/server/cio/backend/SocketAddressUtils.nonJvm.kt similarity index 65% rename from ktor-server/ktor-server-cio/jsAndWasmShared/src/io/ktor/server/cio/backend/SocketAddressUtils.jsAndWasmShared.kt rename to ktor-server/ktor-server-cio/nonJvm/src/io/ktor/server/cio/backend/SocketAddressUtils.nonJvm.kt index 460a9d176e8..0aea2e82efd 100644 --- a/ktor-server/ktor-server-cio/jsAndWasmShared/src/io/ktor/server/cio/backend/SocketAddressUtils.jsAndWasmShared.kt +++ b/ktor-server/ktor-server-cio/nonJvm/src/io/ktor/server/cio/backend/SocketAddressUtils.nonJvm.kt @@ -8,6 +8,6 @@ import io.ktor.network.sockets.* import io.ktor.util.network.* internal actual fun SocketAddress.toNetworkAddress(): NetworkAddress { - val inetAddress = this as? InetSocketAddress ?: error("Expected inet socket address") - return NetworkAddress(inetAddress.hostname, inetAddress.port) + check(this is InetSocketAddress) { "Expected inet socket address" } + return NetworkAddress(hostname, port) } diff --git a/ktor-server/ktor-server-cio/posix/src/io/ktor/server/cio/backend/SocketAddressUtilsNative.kt b/ktor-server/ktor-server-cio/posix/src/io/ktor/server/cio/backend/SocketAddressUtilsNative.kt deleted file mode 100644 index 460a9d176e8..00000000000 --- a/ktor-server/ktor-server-cio/posix/src/io/ktor/server/cio/backend/SocketAddressUtilsNative.kt +++ /dev/null @@ -1,13 +0,0 @@ -/* - * Copyright 2014-2022 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. - */ - -package io.ktor.server.cio.backend - -import io.ktor.network.sockets.* -import io.ktor.util.network.* - -internal actual fun SocketAddress.toNetworkAddress(): NetworkAddress { - val inetAddress = this as? InetSocketAddress ?: error("Expected inet socket address") - return NetworkAddress(inetAddress.hostname, inetAddress.port) -}