2 Commits
Author SHA1 Message Date
Aryan Shah bf446775a1 Wait for writes to drain before closing in NIOHTTP2ServerConnectionManagementHandler (#582)
### Motivation

`NIOHTTP2ServerConnectionManagementHandler` was derived from the
implementation in
[`gRPC-swift-nio-transport`](https://github.com/grpc/grpc-swift-nio-transport/blob/main/Sources/GRPCNIOTransportCore/Server/Connection/ServerConnectionManagementHandler.swift).

In that implementation, PR
https://github.com/grpc/grpc-swift-nio-transport/pull/183 updated the
way how the channel is closed. The channel is now first half-closed and
then fully-closed in order to allow all pending writes to drain.

This is also applicable in this implementation, so we should apply the
same change here.

### Modifications

Applied the changes verbatim from PR
https://github.com/grpc/grpc-swift-nio-transport/pull/183.

### Result

Pending writes are drained when gracefully shutting down.
2026-11-17 10:10:41 +00:00
aryan-25 b6571f3db4 Add a server connection manager (#532)
Motivation:

`NIOHTTP2Handler` currently does not support graceful shutdown because
it does not action upon a `ChannelShouldQuiesceEvent` event. See issue
https://github.com/apple/swift-nio-http2/issues/336.

Per the
[comment](https://github.com/apple/swift-nio-http2/issues/336#issuecomment-2252862397)
on that issue,
[`gRPC-swift-nio-transport`](https://github.com/grpc/grpc-swift-nio-transport)
implements this functionality in a separate channel handler, named
[`ServerConnectionManagementHandler`](https://github.com/grpc/grpc-swift-nio-transport/blob/main/Sources/GRPCNIOTransportCore/Server/Connection/ServerConnectionManagementHandler.swift).
We should introduce this to this repo too.

Modifications:

- Added `ServerConnectionManagementHandler` from
`gRPC-swift-nio-transport` with some slight modifications such as
removing gRPC-specific functionality like policing client pings.
- Added a new `configureAsyncHTTP2Pipeline` helper, which takes a
connection manager configuration as an argument and sets the
connection manager up alongside `NIOHTTP2Handler`.

Result:

Addresses issue https://github.com/apple/swift-nio-http2/issues/336.
2026-02-18 08:08:55 +00:00