-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
OkHttp: Flushes headers out immediately for client streaming and bidi streaming #274
Conversation
I am curious why this is the way to do. This actually doubles the number of On Tue, Apr 7, 2015 at 12:03 AM, Xudong Ma notifications@github.com wrote:
|
@iamqizhao, you are right, this flush should only be made for client streaming and bi-di streaming. I'll continue working on it. |
Can you elaborate why it is necessary for client streaming and bi-di On Tue, Apr 7, 2015 at 12:24 AM, Xudong Ma notifications@github.com wrote:
|
@iamqizhao, my understanding is that there may be some use cases like I made in the test: the server side wants to decide (maybe after checking some metadata in the Header like you said) whether the client can start sending. |
On Tue, Apr 7, 2015 at 12:38 AM, Xudong Ma notifications@github.com wrote:
|
StreamingInputCallResponse response = responseObserver.firstValue().get(); | ||
// Server sent a special message to tell us start uploading. | ||
assertEquals(-1, response.getAggregatedPayloadSize()); | ||
for (StreamingInputCallRequest request : requests) { |
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.
Is there much of a point in actually sending any requests at this point? Even if one request is useful, why 4?
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.
No point, just copied the code from the clientStreaming test.
I'll change it to just 1.
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.
Done.
@iamqizhao, no. That is just the wanted semantics. I would be strongly oppose special casing the flush only if there is custom metadata. We should always do it or never do it. Given the zero-message semantics of streaming and the ability of long-lived requests, the most sensible thing seemed to be to flush. @a11r felt the same way, even before I shared my opinion. |
@ejona86 Could you take another look, thanks! |
@ejona86 PTAL, thanks! |
On Tue, Apr 7, 2015 at 9:54 AM, Eric Anderson notifications@github.com
|
Ping, any update? @iamqizhao @ejona86 |
@madongfly, I'm still unsettled about the integration test. Can we do this change without a new integration test? If you'd like, you can add a new TODO to our integration test doc (if you reference me (with @) then I'd be happy to merge the change). A unit test in OkHttpClientTransportTest should be enough for now. |
@ejona86 Why do you dislike a new integration test? Are you planing to make the integration test only implement the tests listed on the integration test doc? Based on the only change made in this PR: flushing after synStream(), I think either we have a integration test to check the behavior in the wire level, or we just trust the newly added flush call and ignore the test. Having an unit test in OkHttpClientTransportTest to check whether the flush is called seems meaningless. |
@madongfly, the integration test proto is being kept in sync between all the languages. It is shared. I don't want to add something to it that I don't think should be implemented in all languages in the current form. I'm suggesting that integration test is not a strong option at the moment. If we have an integration test, then yes, you could argue that a unit test is meaningless (although I could disagree with that). But a unit test doesn't seem meaningless if we don't have an integration test. Given the size and nature of the change, I'm not super-concerned about a unit test (I'd merge without), but it would be nice. |
@ejona86 Done, PTAL, thanks! |
@madongfly, LGTM. #338 has advanced enough that we know how it relates to this PR. I was delaying to see how the Netty version looked. |
…are of the stream before receiving real data (or half close). Resolves grpc#257.
Flushes headers out immediately for OkHttp transport, so that the server can be aware of the stream before receiving real data (or half close).
Adds corresponding test to AbstractTransportTest.