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 15a6560
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 10 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

0 comments on commit 15a6560

Please sign in to comment.