grpc-swift
grpc-swift copied to clipboard
Synthesise status when stream closes unexpectedly
Motivation
When the stream closes unexpectedly (the H2 stream channel becomes inactive, an error is fired through the pipeline, or we receive a RST_STREAM frame), the client-side inbound sequence either finishes or throws an error.
To make it easier for higher layers to retry, we want to synthesise a Status instead.
Modifications
- On the client side, write a
Statuswhen one of the aforementioned unexpected closures happens. - On the server side, make sure we're always firing an error when closing unexpectedly. I'm not sure this is the right thing to do though.
- On both, make sure we transition the stream state machine to closed.
Result
Inbound sequence now returns a Status instead of finishing/throwing