Browse Source

Adopt h2handler multiplexer (#1587)

Motivation:

Switch from `HTTP2StreamMultiplexer` to `HTTP2Handler.StreamMultiplexer`
to benefit from improved performance due to reduced allocations.

Modifications:

- Replace all references to  `HTTP2StreamMultiplexer` with `HTTP2Handler.StreamMultiplexer`.
- `GRPCIdleHandler` is now a `NIOHTTP2StreamDelegate` to allow it to
  receive notifications when a stream is created or closed rather than
  using `UserInboundEvent`s.
- `GRPCIdleHandler` now has two states of configuration in the client
  case. This is required to break a cycle of dependencies which would
  otherwise exist at `init` because the `GRPCIdleHandler` holds a reference
  to the `HTTP2Handler.StreamMultiplexer` (which is a member of the
  `HTTP2Handler` itself) and the `HTTP2Handler` holds a reference back to the
  `GRPCIdleHandler` as its stream delegate.
- Several tests now insert `HTTP2Handler` into the pipeline where they
  used to use `HTTP2StreamMultiplexer`. This causes a few changes in
  behavior often around different assertions. This required some small
  supporting changes.
- Introduce test infrastructure `AsyncEventStreamConnectionPoolDelegate`
  to eliminate observed racey behavior in `EventRecordingConnectionPoolDelegate`.

Result:

Performance increase without Overall behavior changes.
Rick Newton-Rogers 2 years ago
parent
commit
89961fac0a
1 changed files with 8 additions and 0 deletions
  1. 8 0
      NOTICES.txt

+ 8 - 0
NOTICES.txt

@@ -25,3 +25,11 @@ framework: 'test_01_allocation_counts.sh', 'run-nio-alloc-counter-tests.sh' and
     * https://github.com/apple/swift-nio/blob/main/LICENSE.txt
   * HOMEPAGE:
     * https://github.com/apple/swift-nio
+
+This product contains a simplified derivation of SwiftNIO HTTP/2's
+'HTTP2FrameEncoder' for testing purposes.
+
+  * LICENSE (Apache License 2.0):
+    * https://github.com/apple/swift-nio-http2/blob/main/LICENSE.txt
+  * HOMEPAGE:
+    * https://github.com/apple/swift-nio-http2