-
Notifications
You must be signed in to change notification settings - Fork 19
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
Delete HalfClosedLocal
#84
Conversation
the server closes its read end of a stream? Also, are you talking about |
@@ -288,7 +281,6 @@ frameSender ctx@Context{outputQ,controlQ,encodeDynamicTable,outputBufferLimit} | |||
fillFrameHeader FrameData datPayloadLen streamNumber flag buf | |||
off'' <- handleTrailers mtrailers off' | |||
void tell | |||
when (isServer ctx) $ halfClosedLocal ctx strm Finished |
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.
Isn't it good enough to remove this line only?
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.
fce595b added isServer
.
I cannot remember why.
We should call |
No, that's the thing. It's calling http2/Network/HTTP2/Arch/Sender.hs Line 291 in e41e3f6
or (2) immediately (for http2/Network/HTTP2/Arch/Sender.hs Line 156 in e41e3f6
The consequence of http2/Network/HTTP2/Arch/Receiver.hs Line 389 in e41e3f6
I think both of these calls to
Since these are the only two calls to Note that if the client closes their write end of the stream (which is when we're not expecting any output anymore), we will already call |
3258f18
to
fe75d5d
Compare
Rebased on latest |
Obsoleted by #90. |
This is the third patch in a patch set of three patches; the first two are #82 and #83, although this PR does not strictly speaking depend on those two PRs (at least in the sense that it can build without).
@kazu-yamamoto , before I explain this PR , a side note: this is the PR I am least sure about, because it's a bit "aggressive": it makes a relatively big change to the library, and it's possible that I've not taken something into account and we need to find a different solution. If that is the case, please let me know.
The motivation for this PR has the same general theme as the motivation for #83. Prior to this PR, the
http2
library assumes that once the server closes its write end of a stream, any data frames sent on that stream by the client to the server can silently be ignored. This is perhaps also justified in the web server case: if the only purpose of the input from the client is to tell the server what information to send, then if the server is done sending information, no further input from the client is required.However, in the general case again this is not ok. My use case is remote procedure calls (gRPC); it's entirely possible that after the server has finished sending information to the client (including HTTP2 trailers), the client might still need to send a lot of information to the server. Indeed, other than "the client is the node that initiates the request", there isn't really a major difference between client and server in gRPC. For example, the client might contact the server, say "I'm going to stream some information to you, after you give me some parameters"; the server might respond with those parameters, and then the client might start streaming that information to the server.
So this PR makes perhaps a bit of an extreme change: it removes the
HalfClosedLocal
state fromhttp2
entirely. It was already not used on the client side; now it's also not used on the server side (it no longer exists). This means that even when the server closes their end of a stream, any data frames coming from the client are still processed as normal.I don't think this will cause issues for other use cases, however, I cannot be completely sure; this is where I am a little uncertain about this PR. After all, there must be a reason why the
HalfClosedLocal
state was introduced in the first place? So, if we need a different solution here, please do let me know.