hyperium / h2

HTTP 2.0 client & server implementation for Rust.
MIT License
1.34k stars 265 forks source link

Documentation: How to handle GOAWAY #741

Open eaufavor opened 5 months ago

eaufavor commented 5 months ago

The problem: it is not clear what a stream should do when receiving a GOAWAY h2 error.

Per https://datatracker.ietf.org/doc/html/rfc7540#section-6.8

GOAWAY allows an endpoint to gracefully stop accepting new streams while still finishing processing of previously established streams

So say when h2::RecvStream.data() gets an GOAWAY error, should we terminate the stream with an error or should we ignore this error (and continue processing)?

dswij commented 5 months ago

I guess it depends on the error code https://datatracker.ietf.org/doc/html/rfc7540#section-7, and up to the implementer to decide what to do.

eaufavor commented 5 months ago

My question is how the APIs of this crate is designed regarding GOAWAY. For example if I get GOAWAY with NO_ERROR (graceful shutdown) when reading, should I just ignore it continue processing my request?

If that is true, what is the point of returning the such errors to streams, just FYI?