aboutsummaryrefslogtreecommitdiff
path: root/kvision-modules
diff options
context:
space:
mode:
authorRobert Jaros <rjaros@finn.pl>2019-09-24 11:54:27 +0200
committerRobert Jaros <rjaros@finn.pl>2019-09-24 11:54:27 +0200
commit5921f49346953731e32200935a1efb7e6b1a3218 (patch)
tree5e0bf43ac5647b014c734f306dd4ef53af8835c8 /kvision-modules
parentfb977dc05dd3d32f4fa48abc8d9e7bfc641d0227 (diff)
downloadkvision-5921f49346953731e32200935a1efb7e6b1a3218.tar.gz
kvision-5921f49346953731e32200935a1efb7e6b1a3218.tar.bz2
kvision-5921f49346953731e32200935a1efb7e6b1a3218.zip
Catch closed channel exception
Diffstat (limited to 'kvision-modules')
-rw-r--r--kvision-modules/kvision-server-ktor/src/main/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt6
1 files changed, 5 insertions, 1 deletions
diff --git a/kvision-modules/kvision-server-ktor/src/main/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt b/kvision-modules/kvision-server-ktor/src/main/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt
index 847604fb..7ccd6341 100644
--- a/kvision-modules/kvision-server-ktor/src/main/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt
+++ b/kvision-modules/kvision-server-ktor/src/main/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt
@@ -42,6 +42,7 @@ import io.ktor.websocket.WebSocketServerSession
import io.ktor.websocket.webSocket
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.channels.Channel
+import kotlinx.coroutines.channels.ClosedSendChannelException
import kotlinx.coroutines.channels.ReceiveChannel
import kotlinx.coroutines.channels.SendChannel
import kotlinx.coroutines.coroutineScope
@@ -402,7 +403,10 @@ actual open class KVServiceManager<T : Any> actual constructor(val serviceClass:
)
outgoing.send(Frame.Text(text))
}
- session.close(CloseReason(CloseReason.Codes.NORMAL, ""))
+ try {
+ session.close(CloseReason(CloseReason.Codes.NORMAL, ""))
+ } catch (e: ClosedSendChannelException) {
+ }
session.close()
}
launch {