Skip to content

Commit 82233f0

Browse files
committed
fix(rt): isClosedForRead implies availableForRead is zero
The new roundTrip integrity checks found a case where `isClosedForRead` flag was erroneously false. This was due to the fact that the segments channel was drained but the current segment had not been completely read. Updated the flag to explicitly include the implied behavior that once `isClosedForRead` is true the channel will never return any additional bytes from a read() call.
1 parent eda6800 commit 82233f0

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

aws-runtime/http-client-engine-crt/common/src/aws/sdk/kotlin/runtime/http/engine/crt/AbstractBufferedReadChannel.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ internal abstract class AbstractBufferedReadChannel(
4646
get() = segments.isClosedForSend
4747

4848
override val isClosedForRead: Boolean
49-
get() = closed != null && segments.isClosedForReceive
49+
get() = availableForRead <= 0 && closed != null && segments.isClosedForReceive
5050

5151
override val availableForRead: Int
5252
get() = _availableForRead.value

0 commit comments

Comments
 (0)