feat(error): add h2_go_away_reason() to expose GOAWAY reason code by edef1c · Pull Request #4052 · hyperium/hyper · GitHub
Skip to content

feat(error): add h2_go_away_reason() to expose GOAWAY reason code - #4052

Open
edef1c wants to merge 1 commit into
hyperium:masterfrom
edef1c:push-okymqovvyvmu
Open

feat(error): add h2_go_away_reason() to expose GOAWAY reason code#4052
edef1c wants to merge 1 commit into
hyperium:masterfrom
edef1c:push-okymqovvyvmu

Conversation

@edef1c

@edef1c edef1c commented Apr 13, 2026

Copy link
Copy Markdown

Add a public method on Error that lets callers distinguish h2 GOAWAY rejections from other h2 errors. Returns the GOAWAY reason as Option, avoiding leaking h2::Reason into hyper's public API.

This unblocks tonic and other middleware from implementing transparent retry of GOAWAY-rejected streams per RFC 9113 §6.8.

Add a public method on Error that lets callers distinguish h2 GOAWAY
rejections from other h2 errors. Returns the GOAWAY reason as Option<u32>,
avoiding leaking h2::Reason into hyper's public API.

This unblocks tonic and other middleware from implementing transparent
retry of GOAWAY-rejected streams per RFC 9113 §6.8.
@seanmonstar

Copy link
Copy Markdown
Member

@edef1c

edef1c commented Apr 14, 2026

Copy link
Copy Markdown
Author

I'm specifically exposing the error code so tonic can retry in NO_ERROR case (and indeed on RST_STREAM with REFUSED_STREAM), without blindly retrying in the other cases. Would we want is_protocol_nack to expose just that one? I think ENHANCE_YOUR_CALM might be useful to surface as well. That could be handled by exposing the already-existing h2_reason method.

A complication is that grpc/grpc-rust@master...edef1c:tonic:push-rosuyzxnysvw also depends on being able to recognise DispatchGone, but that should presumably count as a NACK as well, since we know the request hasn't been dispatched. h2_reason would presumably return InternalError, though.

@seanmonstar

Copy link
Copy Markdown
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants