Skip to content

Commit 58a21ea

Browse files
committed
small fix
1 parent bd5a4c8 commit 58a21ea

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

kotlinx-coroutines-core/common/src/channels/BufferedChannel.kt

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -302,12 +302,8 @@ internal open class BufferedChannel<E>(
302302
// the channel is already closed, storing a waiter is illegal, so
303303
// the algorithm stores the `INTERRUPTED_SEND` token in this case.
304304
when (updateCellSend(segment, i, element, s, waiter, closed)) {
305-
RESULT_RENDEZVOUS -> {
306-
// A rendezvous with a receiver has happened.
307-
return onRendezvousOrBuffered()
308-
}
309-
RESULT_BUFFERED -> {
310-
// The element has been buffered.
305+
RESULT_BUFFERED, RESULT_RENDEZVOUS -> {
306+
// The element has been buffered or a rendezvous with a receiver has happened.
311307
return onRendezvousOrBuffered()
312308
}
313309
RESULT_SUSPEND -> {
@@ -2422,7 +2418,7 @@ internal open class BufferedChannel<E>(
24222418
val segment = it.segment
24232419
// Advance the `bufferEnd` segment if required.
24242420
if (!isRendezvousOrUnlimited && id <= bufferEndCounter / SEGMENT_SIZE) {
2425-
bufferEndSegment.value.let { bufferEndSegment.moveToSpecifiedOrLast(id, it) }
2421+
bufferEndSegment.moveToSpecifiedOrLast(id, bufferEndSegment.value)
24262422
}
24272423
// Is the required segment removed?
24282424
if (segment.id > id) {

0 commit comments

Comments
 (0)