diff --git a/mirai-core/src/androidMain/kotlin/net/mamoe/mirai/utils/io/PlatformSocket.kt b/mirai-core/src/androidMain/kotlin/net/mamoe/mirai/utils/io/PlatformSocket.kt index 63c24bf63..4dc89d2a0 100644 --- a/mirai-core/src/androidMain/kotlin/net/mamoe/mirai/utils/io/PlatformSocket.kt +++ b/mirai-core/src/androidMain/kotlin/net/mamoe/mirai/utils/io/PlatformSocket.kt @@ -30,7 +30,7 @@ actual class PlatformSocket : Closeable { @PublishedApi internal lateinit var readChannel: BufferedInputStream - actual suspend inline fun send(packet: ByteArray, offset: Int, length: Int) { + actual suspend fun send(packet: ByteArray, offset: Int, length: Int) { withContext(Dispatchers.IO) { writeChannel.write(packet, offset, length) writeChannel.flush() @@ -40,7 +40,7 @@ actual class PlatformSocket : Closeable { /** * @throws SendPacketInternalException */ - actual suspend inline fun send(packet: ByteReadPacket) { + actual suspend fun send(packet: ByteReadPacket) { withContext(Dispatchers.IO) { try { writeChannel.writePacket(packet) @@ -54,7 +54,7 @@ actual class PlatformSocket : Closeable { /** * @throws ReadPacketInternalException */ - actual suspend inline fun read(): ByteReadPacket { + actual suspend fun read(): ByteReadPacket { return withContext(Dispatchers.IO) { try { readChannel.readPacketAtMost(Long.MAX_VALUE) diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/io/PlatformSocket.kt b/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/io/PlatformSocket.kt index d3eb05c20..9e965ce99 100644 --- a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/io/PlatformSocket.kt +++ b/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/io/PlatformSocket.kt @@ -15,17 +15,17 @@ expect class PlatformSocket() : Closeable { /** * @throws SendPacketInternalException */ - suspend inline fun send(packet: ByteArray, offset: Int = 0, length: Int = packet.size - offset) + suspend fun send(packet: ByteArray, offset: Int = 0, length: Int = packet.size - offset) /** * @throws SendPacketInternalException */ - suspend inline fun send(packet: ByteReadPacket) + suspend fun send(packet: ByteReadPacket) /** * @throws ReadPacketInternalException */ - suspend inline fun read(): ByteReadPacket + suspend fun read(): ByteReadPacket val isOpen: Boolean } \ No newline at end of file diff --git a/mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/utils/io/PlatformSocket.kt b/mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/utils/io/PlatformSocket.kt index c3725a19e..479cbb80e 100644 --- a/mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/utils/io/PlatformSocket.kt +++ b/mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/utils/io/PlatformSocket.kt @@ -34,7 +34,7 @@ actual class PlatformSocket : Closeable { @PublishedApi internal lateinit var readChannel: BufferedInputStream - actual suspend inline fun send(packet: ByteArray, offset: Int, length: Int) { + actual suspend fun send(packet: ByteArray, offset: Int, length: Int) { withContext(Dispatchers.IO) { writeChannel.write(packet, offset, length) writeChannel.flush() @@ -44,7 +44,7 @@ actual class PlatformSocket : Closeable { /** * @throws SendPacketInternalException */ - actual suspend inline fun send(packet: ByteReadPacket) { + actual suspend fun send(packet: ByteReadPacket) { withContext(Dispatchers.IO) { try { writeChannel.writePacket(packet) @@ -58,7 +58,7 @@ actual class PlatformSocket : Closeable { /** * @throws ReadPacketInternalException */ - actual suspend inline fun read(): ByteReadPacket { + actual suspend fun read(): ByteReadPacket { return withContext(Dispatchers.IO) { try { readChannel.readPacketAtMost(Long.MAX_VALUE)