Skip to content

登录或重连时遇到 timeout (TimeoutCancellationException) 时没有重连 #2504

@Him188

Description

@Him188

可添加 test 复现:

net.mamoe.mirai.internal.network.impl.common.CommonNHBotNormalLoginTest#test first login failed with CancellationException

    @Test
    fun `test first login failed with CancellationException`() = runBlockingUnit {
        var first = true
        setSsoProcessor {
            if (first) {
                first = false
                throw CancellationException("Timed out!")
            }
        }
        bot.login()
        assertState(NetworkHandler.State.OK)
    }

注意此测试仅供参考, 实际上不能捕获 CancellationException, 而只能捕获 TimeoutCancellationException. 因为 CancellationException 可能是用户发起的

Metadata

Metadata

Assignees

No one assigned

    Labels

    M优先级: 主要s:core子系统: mirai-coret:bug类型: bug

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions