Increase buffer size for uploading image

This commit is contained in:
Him188 2020-04-13 10:50:58 +08:00
parent f7f3e88878
commit fe764d1fa8
3 changed files with 9 additions and 8 deletions

View File

@ -25,7 +25,6 @@ import kotlinx.io.core.Input
import kotlinx.io.core.discardExact import kotlinx.io.core.discardExact
import kotlinx.io.core.readAvailable import kotlinx.io.core.readAvailable
import kotlinx.io.core.use import kotlinx.io.core.use
import kotlinx.io.pool.useInstance
import kotlinx.serialization.InternalSerializationApi import kotlinx.serialization.InternalSerializationApi
import net.mamoe.mirai.qqandroid.network.QQAndroidClient import net.mamoe.mirai.qqandroid.network.QQAndroidClient
import net.mamoe.mirai.qqandroid.network.protocol.data.proto.CSDataHighwayHead import net.mamoe.mirai.qqandroid.network.protocol.data.proto.CSDataHighwayHead

View File

@ -30,7 +30,8 @@ import net.mamoe.mirai.qqandroid.utils.io.serialization.toByteArray
import net.mamoe.mirai.utils.MiraiInternalAPI import net.mamoe.mirai.utils.MiraiInternalAPI
@OptIn(MiraiInternalAPI::class, InternalSerializationApi::class) @OptIn(MiraiInternalAPI::class, InternalSerializationApi::class)
internal fun createImageDataPacketSequence( // RequestDataTrans internal fun createImageDataPacketSequence(
// RequestDataTrans
client: QQAndroidClient, client: QQAndroidClient,
command: String, command: String,
appId: Int = 537062845, appId: Int = 537062845,
@ -42,7 +43,7 @@ internal fun createImageDataPacketSequence( // RequestDataTrans
data: Any, data: Any,
dataSize: Int, dataSize: Int,
fileMd5: ByteArray, fileMd5: ByteArray,
sizePerPacket: Int = 8192.coerceAtMost(ByteArrayPool.BUFFER_SIZE) sizePerPacket: Int = ByteArrayPool.BUFFER_SIZE
): Flow<ByteReadPacket> { ): Flow<ByteReadPacket> {
ByteArrayPool.checkBufferSize(sizePerPacket) ByteArrayPool.checkBufferSize(sizePerPacket)
require(data is Input || data is InputStream || data is ByteReadChannel) { "unsupported data: ${data::class.simpleName}" } require(data is Input || data is InputStream || data is ByteReadChannel) { "unsupported data: ${data::class.simpleName}" }

View File

@ -64,7 +64,8 @@ internal class DomainIpInfo(
internal class DomainIpList( internal class DomainIpList(
@JceId(0) val uDomainType: Int, @JceId(0) val uDomainType: Int,
@JceId(1) val vIplist: List<DomainIpInfo>, @JceId(1) val vIplist: List<DomainIpInfo>,
@JceId(2) val unknown: ByteArray // added @JceId(2) val unknown: ByteArray? = null,
@JceId(4) val int: Int? = null// added
) : JceStruct ) : JceStruct
@Serializable @Serializable