From c74205f9a61b7adbf6f68c2ac0ff97c4ec670295 Mon Sep 17 00:00:00 2001 From: anlicheng <244108715@qq.com> Date: Fri, 22 May 2026 16:05:19 +0800 Subject: [PATCH] fix SuperClient --- Tun/Super/SDLSuperClient.swift | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Tun/Super/SDLSuperClient.swift b/Tun/Super/SDLSuperClient.swift index 205dac6..f9cec3a 100644 --- a/Tun/Super/SDLSuperClient.swift +++ b/Tun/Super/SDLSuperClient.swift @@ -54,13 +54,14 @@ actor SDLSuperClient { }, queue ) - SDLLogger.log("[SDLSuperClient] start with tls protocol", for: .debug) let params = NWParameters(tls: options) // 关键:让 Network.framework 忽略系统代理 params.preferNoProxies = true self.connection = NWConnection(host: Self.makeEndpointHost(address: serverEndpoint.ip), port: .init(rawValue: port)!, using: params) + + SDLLogger.log("[SDLSuperClient] start with tls protocol", for: .debug) } func start() { @@ -158,6 +159,10 @@ actor SDLSuperClient { } private static func readOnce(connection: NWConnection) async throws -> Data { + guard connection.state == .ready else { + throw SDLSuperError.connectionCancelled + } + let readContinuation = OnceContinuation() return try await withTaskCancellationHandler {