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-5332 Fixes iOS unit test deadlock occurring with DarwinClientEngine #3291

Merged
merged 4 commits into from Dec 14, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
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 @@ -18,7 +18,7 @@ import kotlin.coroutines.*

@OptIn(InternalAPI::class)
internal class DarwinClientEngine(override val config: DarwinClientEngineConfig) : HttpClientEngineBase("ktor-darwin") {
private val requestQueue = NSOperationQueue()
private val requestQueue: NSOperationQueue? = NSOperationQueue.currentQueue()

override val dispatcher = Dispatchers.Unconfined

Expand Down
Expand Up @@ -13,7 +13,7 @@ import kotlin.coroutines.*
@OptIn(UnsafeNumber::class)
internal class DarwinSession(
private val config: DarwinClientEngineConfig,
requestQueue: NSOperationQueue
requestQueue: NSOperationQueue?
) : Closeable {
private val closed = atomic(false)

Expand Down Expand Up @@ -54,7 +54,7 @@ internal class DarwinSession(
@OptIn(UnsafeNumber::class)
internal fun createSession(
config: DarwinClientEngineConfig,
requestQueue: NSOperationQueue
requestQueue: NSOperationQueue?
): Pair<NSURLSession, KtorNSURLSessionDelegate> {
val configuration = NSURLSessionConfiguration.defaultSessionConfiguration().apply {
setupProxy(config)
Expand Down