Skip to content

Commit 5e38b9f

Browse files
committed
produce/actor: cancellation of a Job should cancel the underlying channel
(close and remove all the pending messages)
1 parent 060f36a commit 5e38b9f

File tree

1 file changed

+3
-3
lines changed
  • core/kotlinx-coroutines-core/src/main/kotlin/kotlinx/coroutines/experimental/channels

1 file changed

+3
-3
lines changed

core/kotlinx-coroutines-core/src/main/kotlin/kotlinx/coroutines/experimental/channels/ChannelCoroutine.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,15 @@ import kotlin.coroutines.experimental.CoroutineContext
2222

2323
internal open class ChannelCoroutine<E>(
2424
parentContext: CoroutineContext,
25-
channel: Channel<E>,
25+
private val _channel: Channel<E>,
2626
active: Boolean
27-
) : AbstractCoroutine<Unit>(parentContext, active), Channel<E> by channel {
27+
) : AbstractCoroutine<Unit>(parentContext, active), Channel<E> by _channel {
2828
val channel: Channel<E>
2929
get() = this
3030

3131
override fun onCancellation(exceptionally: CompletedExceptionally?) {
3232
val cause = exceptionally?.cause
33-
if (!close(cause) && cause != null)
33+
if (!_channel.cancel(cause) && cause != null)
3434
handleCoroutineException(context, cause)
3535
}
3636

0 commit comments

Comments
 (0)