From c42960b706a91d62e1767b363efba408493d19b6 Mon Sep 17 00:00:00 2001 From: Oleg Yukhnevich Date: Tue, 10 Dec 2024 08:47:52 +0200 Subject: [PATCH] add flushIfNeeded --- .../io/rsocket/kotlin/transport/ktor/tcp/KtorTcpConnection.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rsocket-transports/ktor-tcp/src/commonMain/kotlin/io/rsocket/kotlin/transport/ktor/tcp/KtorTcpConnection.kt b/rsocket-transports/ktor-tcp/src/commonMain/kotlin/io/rsocket/kotlin/transport/ktor/tcp/KtorTcpConnection.kt index a07d44e3..ccc08958 100644 --- a/rsocket-transports/ktor-tcp/src/commonMain/kotlin/io/rsocket/kotlin/transport/ktor/tcp/KtorTcpConnection.kt +++ b/rsocket-transports/ktor-tcp/src/commonMain/kotlin/io/rsocket/kotlin/transport/ktor/tcp/KtorTcpConnection.kt @@ -92,9 +92,10 @@ private class KtorTcpConnection( } @OptIn(InternalAPI::class) -private fun ByteWriteChannel.writeFrame(frame: Buffer) { +private suspend fun ByteWriteChannel.writeFrame(frame: Buffer) { writeBuffer.writeInt24(frame.size.toInt()) writeBuffer.transferFrom(frame) + flushIfNeeded() } @OptIn(InternalAPI::class)