Skip to content

Commit

Permalink
Merge pull request #429 from NordicSemiconductor/bugfix/suspend
Browse files Browse the repository at this point in the history
Bug fix: `createBondInsecure()` cannot be suspended
  • Loading branch information
philips77 committed Sep 30, 2022
2 parents cec52bd + a0e3957 commit 2cf1175
Showing 1 changed file with 2 additions and 2 deletions.
Expand Up @@ -25,7 +25,7 @@ import kotlin.coroutines.suspendCoroutine
RequestFailedException::class,
InvalidRequestException::class
)
suspend fun SimpleRequest.suspend() = suspendNonCancellable()
suspend fun Request.suspend() = suspendNonCancellable()

/**
* Suspends the coroutine until the request is completed.
Expand Down Expand Up @@ -366,7 +366,7 @@ suspend inline fun <reified T: WriteResponse> WaitForReadRequest.suspendForRespo
}
}

private suspend fun SimpleRequest.suspendNonCancellable() = suspendCoroutine { continuation ->
private suspend fun Request.suspendNonCancellable() = suspendCoroutine { continuation ->
this
// Make sure the callbacks are called without unnecessary delay.
.setHandler(null)
Expand Down

0 comments on commit 2cf1175

Please sign in to comment.