From 2bf57336ec1716a37b42e61cfbaa1912bcb858f7 Mon Sep 17 00:00:00 2001 From: Si Beaumont Date: Tue, 8 Aug 2023 14:36:51 +0100 Subject: [PATCH] Update to latest NIO with updated protocol negotiation SPI (#414) * Update to latest NIO with updated protocol negotiation API Signed-off-by: Si Beaumont * fixup: Also replace deprecated get().waitForFinalResult() Signed-off-by: Si Beaumont --------- Signed-off-by: Si Beaumont --- Package.swift | 2 +- Sources/NIOHTTP2/HTTP2PipelineHelpers.swift | 2 +- .../ConfiguringPipelineAsyncMultiplexerTests.swift | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Package.swift b/Package.swift index db41ec3..977e956 100644 --- a/Package.swift +++ b/Package.swift @@ -21,7 +21,7 @@ let package = Package( .library(name: "NIOHTTP2", targets: ["NIOHTTP2"]), ], dependencies: [ - .package(url: "https://github.com/apple/swift-nio.git", from: "2.57.0"), + .package(url: "https://github.com/apple/swift-nio.git", from: "2.58.0"), .package(url: "https://github.com/apple/swift-atomics.git", from: "1.0.2"), .package(url: "https://github.com/apple/swift-docc-plugin", from: "1.0.0"), ], diff --git a/Sources/NIOHTTP2/HTTP2PipelineHelpers.swift b/Sources/NIOHTTP2/HTTP2PipelineHelpers.swift index 097896c..d1e9957 100644 --- a/Sources/NIOHTTP2/HTTP2PipelineHelpers.swift +++ b/Sources/NIOHTTP2/HTTP2PipelineHelpers.swift @@ -500,7 +500,7 @@ extension Channel { http1ConnectionInitializer: @escaping NIOChannelInitializerWithOutput, http2ConnectionInitializer: @escaping NIOChannelInitializerWithOutput ) -> EventLoopFuture>>> { - let alpnHandler = NIOTypedApplicationProtocolNegotiationHandler>(eventLoop: self.eventLoop) { result in + let alpnHandler = NIOTypedApplicationProtocolNegotiationHandler>() { result in switch result { case .negotiated("h2"): // Successful upgrade to HTTP/2. Let the user configure the pipeline. diff --git a/Tests/NIOHTTP2Tests/ConfiguringPipelineAsyncMultiplexerTests.swift b/Tests/NIOHTTP2Tests/ConfiguringPipelineAsyncMultiplexerTests.swift index fa747c1..eede616 100644 --- a/Tests/NIOHTTP2Tests/ConfiguringPipelineAsyncMultiplexerTests.swift +++ b/Tests/NIOHTTP2Tests/ConfiguringPipelineAsyncMultiplexerTests.swift @@ -254,7 +254,7 @@ final class ConfiguringPipelineAsyncMultiplexerTests: XCTestCase { // Let's pretend the TLS handler did protocol negotiation for us self.serverChannel.pipeline.fireUserInboundEventTriggered(TLSUserEvent.handshakeCompleted(negotiatedProtocol: "h2")) - let negotiationResult = try await nioProtocolNegotiationResult.get().waitForFinalResult() + let negotiationResult = try await nioProtocolNegotiationResult.getResult() try await assertNoThrow(try await self.assertDoHandshake(client: self.clientChannel, server: self.serverChannel)) @@ -324,7 +324,7 @@ final class ConfiguringPipelineAsyncMultiplexerTests: XCTestCase { // Let's pretend the TLS handler did protocol negotiation for us self.serverChannel.pipeline.fireUserInboundEventTriggered(TLSUserEvent.handshakeCompleted(negotiatedProtocol: "http/1.1")) - let negotiationResult = try await nioProtocolNegotiationResult.get().waitForFinalResult() + let negotiationResult = try await nioProtocolNegotiationResult.getResult() try await self.deliverAllBytes(from: self.clientChannel, to: self.serverChannel) try await self.deliverAllBytes(from: self.serverChannel, to: self.clientChannel)