Skip to content

Commit

Permalink
fix 5.6
Browse files Browse the repository at this point in the history
  • Loading branch information
rnro committed Sep 6, 2023
1 parent 121e221 commit c43f8fd
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ extension InlineStreamMultiplexer {
self.commonStreamMultiplexer.createStreamChannel(multiplexer: .inline(self), streamStateInitializer)
}

internal func createStreamChannel<Output>(_ initializer: @escaping NIOChannelInitializerWithOutput<Output>) -> EventLoopFuture<Output> {
internal func createStreamChannel<Output: Sendable>(_ initializer: @escaping NIOChannelInitializerWithOutput<Output>) -> EventLoopFuture<Output> {
self.commonStreamMultiplexer.createStreamChannel(multiplexer: .inline(self), initializer)
}
}
Expand Down Expand Up @@ -239,7 +239,7 @@ extension NIOHTTP2Handler {
}

/// Create a stream channel initialized with the provided closure
public func createStreamChannel<OutboundStreamOutput>(_ initializer: @escaping NIOChannelInitializerWithOutput<OutboundStreamOutput>) async throws -> OutboundStreamOutput {
public func createStreamChannel<OutboundStreamOutput: Sendable>(_ initializer: @escaping NIOChannelInitializerWithOutput<OutboundStreamOutput>) async throws -> OutboundStreamOutput {
return try await self.inlineStreamMultiplexer.createStreamChannel(initializer).get()
}
}
Expand Down
2 changes: 1 addition & 1 deletion Sources/NIOHTTP2/HTTP2ChannelHandler.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1010,7 +1010,7 @@ extension NIOHTTP2Handler {
/// The type of all `inboundStreamInitializer` callbacks which need to return data.
public typealias StreamInitializer = NIOChannelInitializer
/// The type of NIO Channel initializer callbacks which need to return untyped data.
internal typealias StreamInitializerWithAnyOutput = (Channel) -> EventLoopFuture<Any>
internal typealias StreamInitializerWithAnyOutput = (Channel) -> EventLoopFuture<any Sendable>
#endif

/// Creates a new ``NIOHTTP2Handler`` with a local multiplexer. (i.e. using
Expand Down
9 changes: 4 additions & 5 deletions Sources/NIOHTTP2/HTTP2CommonInboundStreamMultiplexer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ extension HTTP2CommonInboundStreamMultiplexer {
}

extension HTTP2CommonInboundStreamMultiplexer {
internal func _createStreamChannel<Output>(
internal func _createStreamChannel<Output: Sendable>(
_ multiplexer: HTTP2StreamChannel.OutboundStreamMultiplexer,
_ promise: EventLoopPromise<Output>?,
_ streamStateInitializer: @escaping NIOChannelInitializerWithOutput<Output>
Expand All @@ -313,11 +313,10 @@ extension HTTP2CommonInboundStreamMultiplexer {
self.pendingStreams[channel.channelID] = channel

let anyInitializer: NIOChannelInitializerWithOutput<any Sendable> = { channel in
streamStateInitializer(channel).map { $0 }
streamStateInitializer(channel).map { return $0 }
}

let anyPromise: EventLoopPromise<Any>?

if let promise = promise {
anyPromise = channel.baseChannel.eventLoop.makePromise(of: Any.self)
anyPromise?.futureResult.whenComplete { result in
Expand All @@ -335,7 +334,7 @@ extension HTTP2CommonInboundStreamMultiplexer {
channel.configure(initializer: anyInitializer, userPromise: anyPromise)
}

internal func createStreamChannel<Output>(
internal func createStreamChannel<Output: Sendable>(
multiplexer: HTTP2StreamChannel.OutboundStreamMultiplexer,
promise: EventLoopPromise<Output>?,
_ streamStateInitializer: @escaping NIOChannelInitializerWithOutput<Output>
Expand All @@ -348,7 +347,7 @@ extension HTTP2CommonInboundStreamMultiplexer {
}
}

internal func createStreamChannel<Output>(
internal func createStreamChannel<Output: Sendable>(
multiplexer: HTTP2StreamChannel.OutboundStreamMultiplexer,
_ streamStateInitializer: @escaping NIOChannelInitializerWithOutput<Output>
) -> EventLoopFuture<Output> {
Expand Down
4 changes: 2 additions & 2 deletions Sources/NIOHTTP2/HTTP2PipelineHelpers.swift
Original file line number Diff line number Diff line change
Expand Up @@ -596,7 +596,7 @@ extension ChannelPipeline.SynchronousOperations {
/// be used to initiate new streams and iterate over inbound HTTP/2 stream channels.
@available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)
@_spi(AsyncChannel)
public func configureAsyncHTTP2Pipeline<Output>(
public func configureAsyncHTTP2Pipeline<Output: Sendable>(
mode: NIOHTTP2Handler.ParserMode,
configuration: NIOHTTP2Handler.Configuration = .init(),
position: ChannelPipeline.Position = .last,
Expand All @@ -608,7 +608,7 @@ extension ChannelPipeline.SynchronousOperations {
connectionConfiguration: configuration.connection,
streamConfiguration: configuration.stream,
inboundStreamInitializerWithAnyOutput: { channel in
inboundStreamInitializer(channel).map { $0 }
inboundStreamInitializer(channel).map { return $0 }
}
)

Expand Down
6 changes: 3 additions & 3 deletions Sources/NIOHTTP2/HTTP2StreamMultiplexer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ public final class HTTP2StreamMultiplexer: ChannelInboundHandler, ChannelOutboun
/// channel that is created by the remote peer. For servers, these are channels created by
/// receiving a `HEADERS` frame from a client. For clients, these are channels created by
/// receiving a `PUSH_PROMISE` frame from a server. To initiate a new outbound channel, use
/// ``createStreamChannel(promise:_:)-18bxc``.
/// ``createStreamChannel(promise:_:)-1jk0q``.
@available(*, deprecated, renamed: "init(mode:channel:targetWindowSize:outboundBufferSizeHighWatermark:outboundBufferSizeLowWatermark:inboundStreamInitializer:)")
public convenience init(mode: NIOHTTP2Handler.ParserMode, channel: Channel, targetWindowSize: Int = 65535, inboundStreamStateInitializer: ((Channel, HTTP2StreamID) -> EventLoopFuture<Void>)? = nil) {
// We default to an 8kB outbound buffer size: this is a good trade off for avoiding excessive buffering while ensuring that decent
Expand Down Expand Up @@ -170,7 +170,7 @@ public final class HTTP2StreamMultiplexer: ChannelInboundHandler, ChannelOutboun
/// channel that is created by the remote peer. For servers, these are channels created by
/// receiving a `HEADERS` frame from a client. For clients, these are channels created by
/// receiving a `PUSH_PROMISE` frame from a server. To initiate a new outbound channel, use
/// ``createStreamChannel(promise:_:)-18bxc``.
/// ``createStreamChannel(promise:_:)-1jk0q``.
public convenience init(mode: NIOHTTP2Handler.ParserMode,
channel: Channel,
targetWindowSize: Int = 65535,
Expand Down Expand Up @@ -199,7 +199,7 @@ public final class HTTP2StreamMultiplexer: ChannelInboundHandler, ChannelOutboun
/// channel that is created by the remote peer. For servers, these are channels created by
/// receiving a `HEADERS` frame from a client. For clients, these are channels created by
/// receiving a `PUSH_PROMISE` frame from a server. To initiate a new outbound channel, use
/// ``createStreamChannel(promise:_:)-18bxc``.
/// ``createStreamChannel(promise:_:)-1jk0q``.
@available(*, deprecated, renamed: "init(mode:channel:targetWindowSize:outboundBufferSizeHighWatermark:outboundBufferSizeLowWatermark:inboundStreamInitializer:)")
public convenience init(mode: NIOHTTP2Handler.ParserMode,
channel: Channel,
Expand Down

0 comments on commit c43f8fd

Please sign in to comment.