Skip to content

Commit

Permalink
KTOR-6664 Cancel pending incoming messages if the session is closing (#…
Browse files Browse the repository at this point in the history
…3939)

(cherry picked from commit 71738f5)
  • Loading branch information
e5l committed Jan 30, 2024
1 parent 9d8ff84 commit 620b4b6
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ public suspend fun HttpClient.webSocket(
block(it)
} finally {
it.close()
it.incoming.cancel()
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -307,4 +307,19 @@ class WebSocketTest : ClientLoader() {
}
}
}

@Test
fun testIncomingOverflow() = clientTests(ENGINES_WITHOUT_WS) {
config {
install(WebSockets)
}

test { client ->
client.webSocket("$TEST_WEBSOCKET_SERVER/websockets/echo") {
repeat(1000) {
send("test")
}
}
}
}
}

0 comments on commit 620b4b6

Please sign in to comment.