Skip to content

Commit

Permalink
Fix counted channel counter after await
Browse files Browse the repository at this point in the history
  • Loading branch information
e5l committed May 8, 2024
1 parent 9218e53 commit 0721ebc
Showing 1 changed file with 1 addition and 2 deletions.
Expand Up @@ -36,8 +36,7 @@ public class CountedByteReadChannel(public val delegate: ByteReadChannel) : Byte
override suspend fun awaitContent(): Boolean {
val before = delegate.availableForRead
val result = delegate.awaitContent()
val after = delegate.availableForRead
count += (before - after).toLong()
count += (initial - before).toLong()
initial = delegate.availableForRead
return result
}
Expand Down

0 comments on commit 0721ebc

Please sign in to comment.