File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
core/kotlinx-coroutines-io/src/main/kotlin/kotlinx/coroutines/experimental/io Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -1069,7 +1069,13 @@ internal class ByteBufferChannel(
1069
1069
1070
1070
private suspend fun awaitClose () {
1071
1071
if (closed != null ) return
1072
- joining?.awaitClose() ? : error(" Only works for joined" )
1072
+ val joined = joining
1073
+
1074
+ if (joined != null ) {
1075
+ joined.awaitClose()
1076
+ } else if (closed == null ) {
1077
+ error(" Only works for joined" )
1078
+ }
1073
1079
}
1074
1080
1075
1081
internal suspend fun joinFrom (src : ByteBufferChannel , delegateClose : Boolean ) {
@@ -1167,6 +1173,7 @@ internal class ByteBufferChannel(
1167
1173
}
1168
1174
1169
1175
if (joining != null ) break // TODO think of joining chain
1176
+ if (copied >= limit) break
1170
1177
1171
1178
// println("readSuspend?")
1172
1179
if (! src.readSuspend(1 )) {
You can’t perform that action at this time.
0 commit comments