This commit is contained in:
Him188 2020-04-15 10:47:11 +08:00
parent a5b82c5e48
commit f1ac53f115
5 changed files with 19 additions and 19 deletions

View File

@ -18,7 +18,7 @@ import net.mamoe.mirai.data.OnlineStatus
import net.mamoe.mirai.network.NoServerAvailableException
import net.mamoe.mirai.qqandroid.BotAccount
import net.mamoe.mirai.qqandroid.QQAndroidBot
import net.mamoe.mirai.qqandroid.network.protocol.data.jce.FileStoragePushFSSvcList
import net.mamoe.mirai.qqandroid.network.protocol.data.jce.FileStoragePushFSSvcListFuckKotlin
import net.mamoe.mirai.qqandroid.network.protocol.packet.EMPTY_BYTE_ARRAY
import net.mamoe.mirai.qqandroid.network.protocol.packet.PacketLogger
import net.mamoe.mirai.qqandroid.network.protocol.packet.Tlv
@ -122,7 +122,8 @@ internal open class QQAndroidClient(
private val _ssoSequenceId: AtomicInt = atomic(85600)
lateinit var fileStoragePushFSSvcList: FileStoragePushFSSvcList
lateinit var fileStoragePushFSSvcList: FileStoragePushFSSvcListFuckKotlin
internal suspend inline fun useNextServers(crossinline block: suspend (host: String, port: Int) -> Unit) {
@Suppress("UNREACHABLE_CODE", "ThrowableNotThrown") // false positive
retryCatching(bot.client.serverList.size) {

View File

@ -101,7 +101,7 @@ internal class _339(
) : JceStruct
@Serializable
internal class FileStoragePushFSSvcList(
internal class FileStoragePushFSSvcListFuckKotlin(
@JceId(0) val vUpLoadList: List<FileStorageServerListInfo>? = listOf(),
@JceId(1) val vPicDownLoadList: List<FileStorageServerListInfo>? = listOf(),
@JceId(2) val vGPicDownLoadList: List<FileStorageServerListInfo>? = null,

View File

@ -7,7 +7,7 @@ import kotlinx.io.core.toByteArray
import kotlinx.io.core.writeFully
import kotlinx.serialization.MissingFieldException
import kotlinx.serialization.Serializable
import net.mamoe.mirai.qqandroid.network.protocol.data.jce.FileStoragePushFSSvcList
import net.mamoe.mirai.qqandroid.network.protocol.data.jce.FileStoragePushFSSvcListFuckKotlin
import net.mamoe.mirai.qqandroid.utils.autoHexToBytes
import net.mamoe.mirai.qqandroid.utils.io.JceStruct
import net.mamoe.mirai.qqandroid.utils.io.serialization.JceCharset
@ -107,7 +107,7 @@ internal class JceInputTest {
*/
data.loadAs(FileStoragePushFSSvcList.serializer())
data.loadAs(FileStoragePushFSSvcListFuckKotlin.serializer())
}
@Test

View File

@ -98,19 +98,12 @@ internal suspend inline fun <reified E : Event, R> subscribingGetOrNullImpl(
var listener: Listener<E>? = null
@Suppress("DuplicatedCode") // for better performance
listener = coroutineScope.subscribe {
val value = try {
mapper.invoke(this, it)
} catch (e: Exception) {
result = Result.failure(e)
listener!!.complete()
return@subscribe ListeningStatus.STOPPED
result = kotlin.runCatching {
mapper.invoke(this, it) ?: return@subscribe ListeningStatus.LISTENING
}
listener!!.complete()
return@subscribe ListeningStatus.STOPPED
if (value != null) {
result = Result.success(value)
listener!!.complete()
return@subscribe ListeningStatus.STOPPED
} else return@subscribe ListeningStatus.LISTENING
}
listener.join()