mirror of
https://github.com/apple/swift-nio
synced 2026-11-24 04:37:54 +00:00
Adopt swift-format (#2794)
* Apply formatting
* Apply no block comments rule
* Apply OmitExplicitReturns
* Apple OnlyOneTrailingClosureArgument
* Apply NoAssignmentInExpressions
* Fix up DontRepeatTypeInStaticProperties lint errors
* Apply `OrderedImports`
* Apply `ReplaceForEachWithForLoop`
* format file
* Enable the formatting pipeline
* Adopt `AmbiguousTrailingClosureOverload`
* Fix license header
* Fix format check
* Fix `EndOfLineComment`
* Fix CI
* Adapt CI script to check if changes when running formatting
* Separate lint and format into to steps
* Fix format
* Adopt `UseEarlyExits`
* Revert "Adopt `UseEarlyExits`"
This reverts commit d1ac5bbe12.
This commit is contained in:
1 parent
980bd3e630
commit
c9756e1083
374 files changed
+23992
-14890
No files matched your search
@@ -33,7 +33,7 @@ extension WebSocketErrorCode {
|
||||
case .invalidFrameLength:
|
||||
self = .messageTooLarge
|
||||
case .fragmentedControlFrame,
|
||||
.multiByteControlFrameLength:
|
||||
.multiByteControlFrameLength:
|
||||
self = .protocolError
|
||||
}
|
||||
}
|
||||
@@ -169,7 +169,11 @@ struct WSParser {
|
||||
return .insufficientData
|
||||
}
|
||||
|
||||
self.state = .waitingForData(firstByte: firstByte, length: length, maskingKey: WebSocketMaskingKey(networkRepresentation: maskingKey))
|
||||
self.state = .waitingForData(
|
||||
firstByte: firstByte,
|
||||
length: length,
|
||||
maskingKey: WebSocketMaskingKey(networkRepresentation: maskingKey)
|
||||
)
|
||||
return .continueParsing
|
||||
|
||||
case .waitingForData(let firstByte, let length, let maskingKey):
|
||||
@@ -226,7 +230,7 @@ public final class WebSocketFrameDecoder: ByteToMessageDecoder {
|
||||
public typealias OutboundOut = WebSocketFrame
|
||||
|
||||
/// The maximum frame size the decoder is willing to tolerate from the remote peer.
|
||||
/* private but tests */ let maxFrameSize: Int
|
||||
let maxFrameSize: Int
|
||||
|
||||
/// Our parser state.
|
||||
private var parser = WSParser()
|
||||
@@ -251,7 +255,7 @@ public final class WebSocketFrameDecoder: ByteToMessageDecoder {
|
||||
self.maxFrameSize = maxFrameSize
|
||||
}
|
||||
|
||||
public func decode(context: ChannelHandlerContext, buffer: inout ByteBuffer) throws -> DecodingState {
|
||||
public func decode(context: ChannelHandlerContext, buffer: inout ByteBuffer) throws -> DecodingState {
|
||||
// Even though the calling code will loop around calling us in `decode`, we can't quite
|
||||
// rely on that: sometimes we have zero-length elements to parse, and the caller doesn't
|
||||
// guarantee to call us with zero-length bytes.
|
||||
@@ -262,7 +266,7 @@ public final class WebSocketFrameDecoder: ByteToMessageDecoder {
|
||||
return .continue
|
||||
case .continueParsing:
|
||||
try self.parser.validateState(maxFrameSize: self.maxFrameSize)
|
||||
// loop again, might be 'waiting' for 0 bytes
|
||||
// loop again, might be 'waiting' for 0 bytes
|
||||
case .insufficientData:
|
||||
return .needMoreData
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user