-
Notifications
You must be signed in to change notification settings - Fork 416
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Synthesise status when stream closes unexpectedly #1953
Conversation
4fa47f6
to
edac48f
Compare
private func getServerUnexpectedInboundCloseAction( | ||
for reason: UnexpectedInboundCloseReason | ||
) -> OnUnexpectedInboundClose { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason this shouldn't be an init
on OnUnexpectedInboundClose
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm I ended up doing this here because we're using this on the server side only (whereas the type itself is also used on the client side logic). But that's probably a not good enough reason, so I can move it.
import XCTest | ||
|
||
@testable import GRPCHTTP2Core | ||
@testable import NIOHTTP2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We really shouldn't do this because we're taking a dependency on the internal API of a module we don't own.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm yes true - we should probably make the constructor public on NIO though, otherwise this API is unusable.
case .doNothing: | ||
context.fireErrorCaught(error) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, is doNothing
the right name here? It's a bit confusing that do nothing fires an error here.
9eb1d5e
to
ab85075
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couple of nits re: duplication but otherwise looks great
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fab, thanks Gus
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
Status
when one of the aforementioned unexpected closures happens.Result
Inbound sequence now returns a
Status
instead of finishing/throwing