-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
KTOR-4827 Fix CIO response delay (#3150)
- Loading branch information
1 parent
b9d20b4
commit 4657cb2
Showing
4 changed files
with
28 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
ktor-server/ktor-server-cio/jvm/src/io/ktor/server/cio/backend/SocketAddressUtilsJvm.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/* | ||
* 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") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
ktor-server/ktor-server-cio/nix/src/io/ktor/server/cio/backend/SocketAddressUtilsNative.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/* | ||
* 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) | ||
} |