Не подтверждена Коммит 4657cb29 создал по автору Thomas Vos's avatar Thomas Vos Зафиксировано автором GitHub
Просмотр файлов

KTOR-4827 Fix CIO response delay (#3150)

владелец b9d20b4b
......@@ -5,6 +5,7 @@
package io.ktor.network.sockets
public fun SocketAddress.toJavaAddress(): java.net.SocketAddress {
// Do not read the hostname here because that may trigger a name service reverse lookup.
return address
}
......
/*
* 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 {
// Do not read the hostname here because that may trigger a name service reverse lookup.
return toJavaAddress() as? java.net.InetSocketAddress ?: error("Expected inet socket address")
}
......@@ -13,7 +13,4 @@ internal val SocketAddress.port: Int
return inetAddress.port
}
internal fun SocketAddress.toNetworkAddress(): NetworkAddress {
val inetAddress = this as? InetSocketAddress ?: error("Expected inet socket address")
return NetworkAddress(inetAddress.hostname, inetAddress.port)
}
internal expect fun SocketAddress.toNetworkAddress(): NetworkAddress
/*
* 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)
}
Поддерживает Markdown
0% или .
You are about to add 0 people to the discussion. Proceed with caution.
Сначала завершите редактирование этого сообщения!
Пожалуйста, зарегистрируйтесь или чтобы прокомментировать