Skip to content

Commit

Permalink
change collecting condition
Browse files Browse the repository at this point in the history
  • Loading branch information
DatL4g committed Jul 20, 2024
1 parent 8181c6c commit 803be57
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ internal class ConnectionServer(
suspendCatching {
val readChannel = boundSocket.openReadChannel()
val buffer = ByteArray(readChannel.availableForRead)
while (true) {
while (currentCoroutineContext().isActive) {
val bytesRead = readChannel.readAvailable(buffer)
if (bytesRead <= 0) {
break
continue
}

listener(buffer)
Expand Down

0 comments on commit 803be57

Please sign in to comment.