fix SuperError
This commit is contained in:
parent
4d9f6b9a42
commit
ae40d46d6f
@ -12,7 +12,7 @@ import CryptoKit
|
||||
import Security
|
||||
|
||||
// 定义错误类型,便于上层处理
|
||||
enum SDLQUICError: Error {
|
||||
enum SDLSuperError: Error {
|
||||
case connectionFailed(Error)
|
||||
case connectionCancelled
|
||||
case writeFailed(Error)
|
||||
@ -123,7 +123,7 @@ actor SDLSuperClient {
|
||||
}
|
||||
}
|
||||
|
||||
private func finishMessageContinuationIfNeed(throwing error: SDLQUICError?) {
|
||||
private func finishMessageContinuationIfNeed(throwing error: SDLSuperError?) {
|
||||
guard !self.isMessageContinuationFinished else {
|
||||
return
|
||||
}
|
||||
@ -181,7 +181,7 @@ actor SDLSuperClient {
|
||||
|
||||
private func readOnce() async throws -> Data {
|
||||
guard let connection = self.connection else {
|
||||
throw SDLQUICError.connectionCancelled
|
||||
throw SDLSuperError.connectionCancelled
|
||||
}
|
||||
|
||||
let readContinuation = OnceContinuation<Data, Error>()
|
||||
@ -196,7 +196,7 @@ actor SDLSuperClient {
|
||||
}
|
||||
|
||||
if isComplete {
|
||||
readContinuation.resume(throwing: SDLQUICError.dataStreamClosed)
|
||||
readContinuation.resume(throwing: SDLSuperError.dataStreamClosed)
|
||||
} else {
|
||||
readContinuation.resume(returning: data ?? Data())
|
||||
}
|
||||
@ -263,7 +263,7 @@ extension SDLSuperClient {
|
||||
}
|
||||
|
||||
if len > self.maxPacketSize {
|
||||
throw SDLQUICError.packetTooLarge
|
||||
throw SDLSuperError.packetTooLarge
|
||||
}
|
||||
|
||||
guard buffer.readableBytes >= len + 2 else {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user