Update to latest NIO with updated protocol negotiation SPI (#414)

* Update to latest NIO with updated protocol negotiation API

Signed-off-by: Si Beaumont <beaumont@apple.com>

* fixup: Also replace deprecated get().waitForFinalResult()

Signed-off-by: Si Beaumont <beaumont@apple.com>

---------

Signed-off-by: Si Beaumont <beaumont@apple.com>
This commit is contained in:
Si Beaumont authored and GitHub committed 2023-08-08 14:36:51 +01:00
1 parent 493897c474
commit 2bf57336ec
3 files changed
+4 -4

No files matched your search

+1 -1
View File
@@ -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"),
],
+1 -1
View File
@@ -500,7 +500,7 @@ extension Channel {
http1ConnectionInitializer: @escaping NIOChannelInitializerWithOutput<HTTP1Output>,
http2ConnectionInitializer: @escaping NIOChannelInitializerWithOutput<HTTP2Output>
) -> EventLoopFuture<EventLoopFuture<NIOProtocolNegotiationResult<NIONegotiatedHTTPVersion<HTTP1Output, HTTP2Output>>>> {
let alpnHandler = NIOTypedApplicationProtocolNegotiationHandler<NIONegotiatedHTTPVersion<HTTP1Output, HTTP2Output>>(eventLoop: self.eventLoop) { result in
let alpnHandler = NIOTypedApplicationProtocolNegotiationHandler<NIONegotiatedHTTPVersion<HTTP1Output, HTTP2Output>>() { result in
switch result {
case .negotiated("h2"):
// Successful upgrade to HTTP/2. Let the user configure the pipeline.
@@ -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)