Adopt `Sendable` in `Codec.swift` and `SingleStepByteToMessageDecoder.swift` (#2149)

Co-authored-by: Cory Benfield <lukasa@apple.com>
This commit is contained in:
David Nadoba 2022-06-01 17:24:21 +02:00 committed by GitHub
parent 97a568ac61
commit 4574bdde82
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 1 deletions

View File

@ -14,7 +14,7 @@
/// State of the current decoding process.
public enum DecodingState {
public enum DecodingState: NIOSendable {
/// Continue decoding.
case `continue`
@ -485,6 +485,11 @@ public final class ByteToMessageHandler<Decoder: ByteToMessageDecoder> {
}
}
#if swift(>=5.7)
@available(*, unavailable)
extension ByteToMessageHandler: Sendable {}
#endif
// MARK: ByteToMessageHandler: Test Helpers
extension ByteToMessageHandler {
internal var cumulationBuffer: ByteBuffer? {
@ -771,6 +776,11 @@ public final class MessageToByteHandler<Encoder: MessageToByteEncoder>: ChannelO
}
}
#if swift(>=5.7)
@available(*, unavailable)
extension MessageToByteHandler: Sendable {}
#endif
extension MessageToByteHandler {
public func handlerAdded(context: ChannelHandlerContext) {
precondition(self.state.readyToBeAddedToChannel,

View File

@ -274,6 +274,10 @@ public final class NIOSingleStepByteToMessageProcessor<Decoder: NIOSingleStepByt
}
}
#if swift(>=5.7)
@available(*, unavailable)
extension NIOSingleStepByteToMessageProcessor: Sendable {}
#endif
// MARK: NIOSingleStepByteToMessageProcessor Public API
extension NIOSingleStepByteToMessageProcessor {