Graceful shutdown (GOAWAY NO_ERROR) currently surfaces as TransportConnectionException
package:http2
Core Request: Consider exposing a graceful shutdown (GOAWAY with NO_ERROR) in a form that callers can distinguish from a forceful close.
Current Implementation: In `pkgs/http2/lib/src/connection.dart`, `_terminate()` is the only site for constructing `TransportConnectionException`, and it hardcodes "Connection is being forcefully terminated" regardless of whether the cause was a peer GOAWAY-NO_ERROR or an actual fault. This issue (#1364 open since 2019) and #1380 track the same surface from different angles.
Context: We initially tried to map `errorCode == 0` at the gRPC layer ([grpc/grpc-dart#827](https://github.com/grpc/grpc-dart/pull/827)), but the maintainer correctly pointed out it's the wrong layer.
Proposed Shapes: In order of least disruptive:
a. A `TransportConnectionException` subtype constructed when `errorCode == NO_ERROR`.
b. Completing `connection.done` cleanly (without exception) on graceful close, which would be breaking but cleaner.
c. Some other shape entirely - RFC 7540 §6.8 leaves room for distinguishing graceful shutdown from error.
Migration Shape: The package's call. Happy to defer if there's a different priority.
5 条评论