Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Adopt Sendable in NIOExtras #174

Merged
merged 3 commits into from
Aug 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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