From f0f147b08a81d679451e8c450e47ffc66d658581 Mon Sep 17 00:00:00 2001 From: Magellan Date: Tue, 28 Nov 2023 14:09:11 +0200 Subject: [PATCH] fix writeDataToNetwork allocArray --- .../kotlin/tigase/halcyon/core/connector/socket/SSLEngine.kt | 2 +- .../tigase/halcyon/core/connector/socket/SocketConnector.kt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/halcyon-core/src/iosMain/kotlin/tigase/halcyon/core/connector/socket/SSLEngine.kt b/halcyon-core/src/iosMain/kotlin/tigase/halcyon/core/connector/socket/SSLEngine.kt index 272b6ea1..90faab41 100644 --- a/halcyon-core/src/iosMain/kotlin/tigase/halcyon/core/connector/socket/SSLEngine.kt +++ b/halcyon-core/src/iosMain/kotlin/tigase/halcyon/core/connector/socket/SSLEngine.kt @@ -178,7 +178,7 @@ class SSLEngine(connector: SocketConnector, domain: String) { val waiting = BIO_ctrl_pending(writeBio).toInt() log.finest("sending ${waiting} bytes..") memScoped { - val buffer = allocArray(2048) + val buffer = allocArray(waiting) n = BIO_read(writeBio, buffer, waiting) if (n > 0) { connector.writeDataToSocket(buffer.readBytes(n)) diff --git a/halcyon-core/src/iosMain/kotlin/tigase/halcyon/core/connector/socket/SocketConnector.kt b/halcyon-core/src/iosMain/kotlin/tigase/halcyon/core/connector/socket/SocketConnector.kt index a29d2822..f4fe66e5 100644 --- a/halcyon-core/src/iosMain/kotlin/tigase/halcyon/core/connector/socket/SocketConnector.kt +++ b/halcyon-core/src/iosMain/kotlin/tigase/halcyon/core/connector/socket/SocketConnector.kt @@ -191,7 +191,7 @@ class SocketConnector(halcyon: Halcyon) : AbstractConnector(halcyon) { if (state == State.Connected) closeStream() state = State.Disconnecting whitespacePingExecutor.stop() - usleep(175000) + usleep(175000u) if (state != State.Disconnected) { socket?.disconnect() }