Skip to content

Commit

Permalink
Update to latest NIO with updated protocol negotiation SPI (#414)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
simonjbeaumont committed Aug 8, 2023
1 parent 493897c commit 2bf5733
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
],
Expand Down
2 changes: 1 addition & 1 deletion Sources/NIOHTTP2/HTTP2PipelineHelpers.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 2bf5733

Please sign in to comment.