mirror of https://github.com/grpc/grpc-java.git
coalesce pending flushes in OkHttpClientStream.start().
This commit is contained in:
parent
036af15b66
commit
097e3a8c65
|
|
@ -125,9 +125,16 @@ class OkHttpClientStream extends Http2ClientStream {
|
||||||
requestHeaders = null;
|
requestHeaders = null;
|
||||||
|
|
||||||
if (pendingData != null) {
|
if (pendingData != null) {
|
||||||
|
boolean flush = false;
|
||||||
while (!pendingData.isEmpty()) {
|
while (!pendingData.isEmpty()) {
|
||||||
PendingData data = pendingData.poll();
|
PendingData data = pendingData.poll();
|
||||||
outboundFlow.data(data.endOfStream, id, data.buffer, data.flush);
|
outboundFlow.data(data.endOfStream, id, data.buffer, false);
|
||||||
|
if (data.flush) {
|
||||||
|
flush = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (flush) {
|
||||||
|
outboundFlow.flush();
|
||||||
}
|
}
|
||||||
pendingData = null;
|
pendingData = null;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -160,7 +160,7 @@ class OutboundFlowController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void flush() {
|
void flush() {
|
||||||
try {
|
try {
|
||||||
frameWriter.flush();
|
frameWriter.flush();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue