Skip to content

Commit

Permalink
fix Bench1Conn10kRequests crash
Browse files Browse the repository at this point in the history
Motivation:

`Bench1Conn10kRequests` performance tester incorrectly used a `NIOLoopBound` to access the `HTTP2StreamMultiplexer` to create streams.

Modifications:

Access the multiplexer by safely obtaining a reference to the handler.

Result:

- `Bench1Conn10kRequests` are not broken

Co-authored-by: George Barnett <[email protected]>
  • Loading branch information
rnro and glbrntt committed Jan 8, 2024
1 parent 69e838f commit 102df9e
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions Sources/NIOHTTP2PerformanceTester/Bench1Conn10kRequests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,8 @@ func sendOneRequest(channel: Channel, multiplexer: HTTP2StreamMultiplexer) throw
ErrorHandler()],
position: .last)
}
let loopBoundMultiplexer = NIOLoopBound(multiplexer, eventLoop: channel.eventLoop)
channel.eventLoop.execute {
loopBoundMultiplexer.value.createStreamChannel(promise: nil, requestStreamInitializer)
channel.pipeline.handler(type: HTTP2StreamMultiplexer.self).whenSuccess { multiplexer in
multiplexer.createStreamChannel(promise: nil, requestStreamInitializer)
}
return try responseReceivedPromise.futureResult.wait()
}
Expand Down

0 comments on commit 102df9e

Please sign in to comment.