Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- val content = object : OutgoingContent.WriteChannelContent() {
- override suspend fun writeTo(channel: ByteWriteChannel) {
- val stream = channel.toOutputStream()
- try {
- withContext(Dispatchers.IO) {
- stream.run {
- write(1)
- write(2)
- flush()
- TODO("oops!")
- }
- }
- } catch (e: Throwable) {
- channel.close(e)
- throw e
- } finally {
- channel.close()
- }
- }
- }
- context.respond(content)
Advertisement
Add Comment
Please, Sign In to add comment