Skip to content

Commit

Permalink
Adopt Sendable in NIOExtras (#174)
Browse files Browse the repository at this point in the history
Incremental `Sendable` adoption.

Co-authored-by: Cory Benfield <lukasa@apple.com>
  • Loading branch information
dnadoba and Lukasa authored Aug 23, 2022
1 parent b64e599 commit 5334d94
Show file tree
Hide file tree
Showing 11 changed files with 58 additions and 1 deletion.
5 changes: 5 additions & 0 deletions Sources/NIOExtras/DebugInboundEventsHandler.swift
Original file line number Diff line number Diff line change
Expand Up @@ -174,3 +174,8 @@ public class DebugInboundEventsHandler: ChannelInboundHandler {
fflush(stdout)
}
}

#if swift(>=5.6)
@available(*, unavailable)
extension DebugInboundEventsHandler: Sendable {}
#endif
5 changes: 5 additions & 0 deletions Sources/NIOExtras/DebugOutboundEventsHandler.swift
Original file line number Diff line number Diff line change
Expand Up @@ -170,3 +170,8 @@ public class DebugOutboundEventsHandler: ChannelOutboundHandler {
fflush(stdout)
}
}

#if swift(>=5.6)
@available(*, unavailable)
extension DebugOutboundEventsHandler: Sendable {}
#endif
5 changes: 5 additions & 0 deletions Sources/NIOExtras/FixedLengthFrameDecoder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,8 @@ public final class FixedLengthFrameDecoder: ByteToMessageDecoder {
return .needMoreData
}
}

#if swift(>=5.6)
@available(*, unavailable)
extension FixedLengthFrameDecoder: Sendable {}
#endif
10 changes: 10 additions & 0 deletions Sources/NIOExtras/JSONRPCFraming+ContentLengthHeader.swift
Original file line number Diff line number Diff line change
Expand Up @@ -214,3 +214,13 @@ extension String {
return self[firstElementIndex ..< lastElementIndex.base]
}
}



#if swift(>=5.6)
@available(*, unavailable)
extension NIOJSONRPCFraming.ContentLengthHeaderFrameDecoder: Sendable {}

@available(*, unavailable)
extension NIOJSONRPCFraming.ContentLengthHeaderFrameEncoder: Sendable {}
#endif
5 changes: 5 additions & 0 deletions Sources/NIOExtras/LengthFieldBasedFrameDecoder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -246,3 +246,8 @@ public final class LengthFieldBasedFrameDecoder: ByteToMessageDecoder {
return frameLength
}
}

#if swift(>=5.6)
@available(*, unavailable)
extension LengthFieldBasedFrameDecoder: Sendable {}
#endif
5 changes: 5 additions & 0 deletions Sources/NIOExtras/LengthFieldPrepender.swift
Original file line number Diff line number Diff line change
Expand Up @@ -144,3 +144,8 @@ public final class LengthFieldPrepender: ChannelOutboundHandler {
context.write(data, promise: promise)
}
}

#if swift(>=5.6)
@available(*, unavailable)
extension LengthFieldPrepender: Sendable {}
#endif
5 changes: 5 additions & 0 deletions Sources/NIOExtras/LineBasedFrameDecoder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -91,3 +91,8 @@ public class LineBasedFrameDecoder: ByteToMessageDecoder {
return nil
}
}

#if swift(>=5.6)
@available(*, unavailable)
extension LineBasedFrameDecoder: Sendable {}
#endif
4 changes: 3 additions & 1 deletion Sources/NIOExtras/NIOLengthFieldBitLength.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@
//
//===----------------------------------------------------------------------===//

import NIOCore

/// A struct to describe the length of a piece of data in bits
public struct NIOLengthFieldBitLength {
public struct NIOLengthFieldBitLength: NIOSendable {
internal enum Backing {
case bits8
case bits16
Expand Down
5 changes: 5 additions & 0 deletions Sources/NIOExtras/PCAPRingBuffer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -96,3 +96,8 @@ public class NIOPCAPRingBuffer {
return toReturn
}
}

#if swift(>=5.6)
@available(*, unavailable)
extension NIOPCAPRingBuffer: Sendable {}
#endif
5 changes: 5 additions & 0 deletions Sources/NIOExtras/RequestResponseHandler.swift
Original file line number Diff line number Diff line change
Expand Up @@ -119,3 +119,8 @@ public final class RequestResponseHandler<Request, Response>: ChannelDuplexHandl
}
}
}

#if swift(>=5.6)
@available(*, unavailable)
extension RequestResponseHandler: Sendable {}
#endif
5 changes: 5 additions & 0 deletions Sources/NIOExtras/WritePCAPHandler.swift
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,11 @@ public class NIOWritePCAPHandler: RemovableChannelHandler {
}
}

#if swift(>=5.6)
@available(*, unavailable)
extension NIOWritePCAPHandler: Sendable {}
#endif

extension NIOWritePCAPHandler: ChannelDuplexHandler {
public typealias InboundIn = ByteBuffer
public typealias InboundOut = ByteBuffer
Expand Down

0 comments on commit 5334d94

Please sign in to comment.