Removed withKryo{} lambda (was causing heap issues)

This commit is contained in:
Robinson 2023-09-06 16:17:36 +02:00
parent b30b024849
commit 0bd725b2d8
No known key found for this signature in database
GPG Key ID: 8E7DB78588BD6F5C
1 changed files with 5 additions and 3 deletions

View File

@ -29,7 +29,6 @@ import java.io.File
internal class FileContentsSerializer<CONNECTION : Connection> : Serializer<File>() {
lateinit var streamingManager: StreamingManager<CONNECTION>
init {
isImmutable = true
}
@ -46,16 +45,19 @@ internal class FileContentsSerializer<CONNECTION : Connection> : Serializer<File
val streamSessionId = CryptoManagement.secureRandom.nextInt()
// use the streaming manager to send the file in blocks to the remove endpoint
endPoint.serialization.withKryo {
val kryo = endPoint.serialization.take()
try {
streamingManager.sendFile(
file = file,
publication = publication,
endPoint = endPoint,
kryo = this,
kryo = kryo,
sendIdleStrategy = sendIdleStrategy,
connection = connection,
streamSessionId = streamSessionId
)
} finally {
endPoint.serialization.put(kryo)
}
// output.writeString(file.path)