Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KTOR-4809 Replace val with fun to fix init order #3158

Merged
merged 1 commit into from Sep 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -6,7 +6,7 @@ package io.ktor.http.cio.internals

import io.ktor.utils.io.pool.*

internal expect val DISABLE_CHAR_ARRAY_POOLING: Boolean
internal expect fun isPoolingDisabled(): Boolean

internal const val CHAR_ARRAY_POOL_SIZE = 4096

Expand All @@ -15,7 +15,7 @@ internal const val CHAR_ARRAY_POOL_SIZE = 4096
*/
internal const val CHAR_BUFFER_ARRAY_LENGTH: Int = 4096 / 2

internal val CharArrayPool: ObjectPool<CharArray> = if (DISABLE_CHAR_ARRAY_POOLING) {
internal val CharArrayPool: ObjectPool<CharArray> = if (isPoolingDisabled()) {
object : NoPoolImpl<CharArray>() {
override fun borrow(): CharArray {
return CharArray(CHAR_BUFFER_ARRAY_LENGTH)
Expand Down
Expand Up @@ -4,4 +4,4 @@

package io.ktor.http.cio.internals

internal actual val DISABLE_CHAR_ARRAY_POOLING: Boolean = false
internal actual fun isPoolingDisabled(): Boolean = false
Expand Up @@ -4,5 +4,5 @@

package io.ktor.http.cio.internals

internal actual val DISABLE_CHAR_ARRAY_POOLING: Boolean =
internal actual fun isPoolingDisabled(): Boolean =
System.getProperty("ktor.internal.cio.disable.chararray.pooling")?.toBoolean() ?: false
Expand Up @@ -4,4 +4,4 @@

package io.ktor.http.cio.internals

internal actual val DISABLE_CHAR_ARRAY_POOLING: Boolean = false
internal actual fun isPoolingDisabled(): Boolean = false