1
0
mirror of https://github.com/mamoe/mirai.git synced 2025-03-26 07:20:09 +08:00

Improve input

This commit is contained in:
Him188 2020-01-31 15:05:02 +08:00
parent 846280db50
commit 56a267dfa3
2 changed files with 5 additions and 0 deletions
mirai-core-timpc/src/commonMain/kotlin/net.mamoe.mirai.timpc/network
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/io

View File

@ -55,6 +55,7 @@ internal class TIMPCBotNetworkHandler internal constructor(coroutineContext: Cor
private var heartbeatJob: Job? = null
@MiraiInternalAPI
override suspend fun login() {
TIMProtocol.SERVER_IP.shuffled().forEach { ip ->

View File

@ -54,6 +54,10 @@ fun ByteReadPacket.readIoBuffer(
n: Int = remaining.toInt()//not that safe but adequate
): IoBuffer = IoBuffer.Pool.borrow().also { this.readFully(it, n) }
fun ByteReadPacket.readPacket(
n: Int = remaining.toInt()//not that safe but adequate
): ByteReadPacket = this.readBytes(n).toReadPacket()
fun ByteReadPacket.readIoBuffer(n: Short) = this.readIoBuffer(n.toInt())
fun Input.readIP(): String = buildString(4 + 3) {