coalesce pending flushes in OkHttpClientStream.start().

This commit is contained in:
Xudong Ma 2015-11-25 12:57:07 -08:00
parent 036af15b66
commit 097e3a8c65
2 changed files with 9 additions and 2 deletions

View File

@ -125,9 +125,16 @@ class OkHttpClientStream extends Http2ClientStream {
requestHeaders = null;
if (pendingData != null) {
boolean flush = false;
while (!pendingData.isEmpty()) {
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;
}

View File

@ -160,7 +160,7 @@ class OutboundFlowController {
}
}
private void flush() {
void flush() {
try {
frameWriter.flush();
} catch (IOException e) {