|
|
|
@ -251,9 +251,10 @@ import QPlayAutoSDK |
|
|
|
let startTime = Date() |
|
|
|
print("QPlayAutoManager: 调用 QPlayAutoSDK.connectAndForceLogin(\(forceLogin))") |
|
|
|
QPlayAutoSDK.connectAndForceLogin(forceLogin) |
|
|
|
|
|
|
|
// 增加超时时间,特别是强制登录时 |
|
|
|
let timeoutInterval: TimeInterval = forceLogin ? 45.0 : 10.0 |
|
|
|
// If connection fails due to socket error, retry after cleanup |
|
|
|
DispatchQueue.main.asyncAfter(deadline: .now() + 3.0) { |
|
|
|
DispatchQueue.main.asyncAfter(deadline: .now() + timeoutInterval) { |
|
|
|
let endTime = Date() |
|
|
|
let duration = endTime.timeIntervalSince(startTime) |
|
|
|
|
|
|
|
@ -410,7 +411,7 @@ import QPlayAutoSDK |
|
|
|
connect(forceLogin: true) |
|
|
|
|
|
|
|
// 设置超时监控(仅记录,不清理回调) |
|
|
|
DispatchQueue.main.asyncAfter(deadline: .now() + 30.0) { [weak self] in |
|
|
|
DispatchQueue.main.asyncAfter(deadline: .now() + 60.0) { [weak self] in |
|
|
|
self?.logLoginTimeout() |
|
|
|
} |
|
|
|
} |
|
|
|
@ -827,6 +828,16 @@ extension QPlayAutoManager: QPlayAutoSDKDelegate { |
|
|
|
print("QPlayAutoManager: ❌ 登录失败,但不立即清理回调(等待重试或最终失败)") |
|
|
|
// 注意:这里不立即调用 notifyLoginCompletion(false) |
|
|
|
// 让重试机制来决定是否最终失败 |
|
|
|
// 如果有等待的回调且不在重试过程中,则通知失败 |
|
|
|
if !loginCompletionHandlers.isEmpty { |
|
|
|
// 给一个短暂的延迟,让重试机制有机会处理 |
|
|
|
DispatchQueue.main.asyncAfter(deadline: .now() + 1.0) { |
|
|
|
if !self.loginCompletionHandlers.isEmpty && !self.isLoginOK { |
|
|
|
print("QPlayAutoManager: 登录失败,清理回调队列") |
|
|
|
self.notifyLoginCompletion(false) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// 通知所有代理 |
|
|
|
|