fix SuperClient
This commit is contained in:
parent
4ce3547c7c
commit
c74205f9a6
@ -54,13 +54,14 @@ actor SDLSuperClient {
|
|||||||
},
|
},
|
||||||
queue
|
queue
|
||||||
)
|
)
|
||||||
SDLLogger.log("[SDLSuperClient] start with tls protocol", for: .debug)
|
|
||||||
|
|
||||||
let params = NWParameters(tls: options)
|
let params = NWParameters(tls: options)
|
||||||
// 关键:让 Network.framework 忽略系统代理
|
// 关键:让 Network.framework 忽略系统代理
|
||||||
params.preferNoProxies = true
|
params.preferNoProxies = true
|
||||||
|
|
||||||
self.connection = NWConnection(host: Self.makeEndpointHost(address: serverEndpoint.ip), port: .init(rawValue: port)!, using: params)
|
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() {
|
func start() {
|
||||||
@ -158,6 +159,10 @@ actor SDLSuperClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static func readOnce(connection: NWConnection) async throws -> Data {
|
private static func readOnce(connection: NWConnection) async throws -> Data {
|
||||||
|
guard connection.state == .ready else {
|
||||||
|
throw SDLSuperError.connectionCancelled
|
||||||
|
}
|
||||||
|
|
||||||
let readContinuation = OnceContinuation<Data, Error>()
|
let readContinuation = OnceContinuation<Data, Error>()
|
||||||
|
|
||||||
return try await withTaskCancellationHandler {
|
return try await withTaskCancellationHandler {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user