File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed
core/src/main/java/com/google/net/stubby Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -238,11 +238,14 @@ public void running() {}
238
238
private class CallImpl <ReqT , RespT > extends Call <ReqT , RespT > {
239
239
private final MethodDescriptor <ReqT , RespT > method ;
240
240
private final SerializingExecutor callExecutor ;
241
+ private final boolean unaryRequest ;
241
242
private ClientStream stream ;
242
243
243
244
public CallImpl (MethodDescriptor <ReqT , RespT > method , SerializingExecutor executor ) {
244
245
this .method = method ;
245
246
this .callExecutor = executor ;
247
+ this .unaryRequest = method .getType () == MethodType .UNARY
248
+ || method .getType () == MethodType .SERVER_STREAMING ;
246
249
}
247
250
248
251
@ Override
@@ -308,7 +311,12 @@ public void sendPayload(ReqT payload) {
308
311
cancel ();
309
312
}
310
313
}
311
- stream .flush ();
314
+ // For unary requests, we don't flush since we know that halfClose should be coming soon. This
315
+ // allows us to piggy-back the END_STREAM=true on the last payload frame without opening the
316
+ // possibility of broken applications forgetting to call halfClose without noticing.
317
+ if (!unaryRequest ) {
318
+ stream .flush ();
319
+ }
312
320
}
313
321
314
322
private class ClientStreamListenerImpl implements ClientStreamListener {
You can’t perform that action at this time.
0 commit comments