Skip to content

Commit

Permalink
Fix Jetty upgrade cancellation on connection close
Browse files Browse the repository at this point in the history
  • Loading branch information
Sergey Mashkov committed Feb 5, 2020
1 parent dfbcbeb commit 614f637
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,17 @@ object JettyUpgradeImpl : ServletUpgrade {
withContext(engineContext) {
try {
coroutineScope {
endPoint.connection.addListener(
object : Connection.Listener {
override fun onOpened(connection: Connection?) {
}

override fun onClosed(connection: Connection?) {
cancel()
}
}
)

val inputChannel = ByteChannel(autoFlush = true)
val reader = EndPointReader(endPoint, coroutineContext, inputChannel)
val writer = endPointWriter(endPoint)
Expand Down

0 comments on commit 614f637

Please sign in to comment.