removed nullable array from transport device, as channels close() is more than enough

This commit is contained in:
sergeych committed 2023-11-20 15:49:58 +03:00
1 parent e7abbe6d1d
commit e619b45485
6 files changed
+30 -17

No files matched your search

@@ -98,7 +98,7 @@ suspend fun asyncSocketToDevice(socket: AsynchronousSocketChannel): InetTranspor
}
}
// transport device copes with blocks:
val inputBlocks = Channel<UByteArray?>()
val inputBlocks = Channel<UByteArray>()
// decode blocks from a byte channel read from the socket:
launch {
try {
@@ -116,9 +116,7 @@ suspend fun asyncSocketToDevice(socket: AsynchronousSocketChannel): InetTranspor
}
}
} catch (_: CancellationException) {
inputBlocks.send(null)
} catch (_: ClosedReceiveChannelException) {
inputBlocks.send(null)
stop()
}
receiving.value = false