fix SuperClient

This commit is contained in:
anlicheng 2026-05-22 16:05:19 +08:00
parent 4ce3547c7c
commit c74205f9a6

View File

@ -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<Data, Error>()
return try await withTaskCancellationHandler {