fix SuperClient
This commit is contained in:
parent
4ce3547c7c
commit
c74205f9a6
@ -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 {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user