Skip to content

Commit a06be73

Browse files
committed
fix
1 parent 804d9a2 commit a06be73

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

okhttp/src/main/java/io/grpc/okhttp/OkHttpClientStream.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -281,10 +281,11 @@ public void deframeFailed(Throwable cause) {
281281
@Override
282282
@GuardedBy("lock")
283283
public void bytesRead(int processedBytes) {
284+
processedWindow -= processedBytes;
284285
if (processedWindow <= initialWindowSize * Utils.DEFAULT_WINDOW_UPDATE_RATIO) {
285286
int delta = initialWindowSize - processedWindow;
287+
window += delta;
286288
processedWindow += delta;
287-
window = initialWindowSize;
288289
frameWriter.windowUpdate(id(), delta);
289290
}
290291
}
@@ -324,8 +325,8 @@ public void transportDataReceived(okio.Buffer frame, boolean endOfStream, int pa
324325
// We only support 16 KiB frames, and the max permitted in HTTP/2 is 16 MiB. This is verified
325326
// in OkHttp's Http2 deframer. In addition, this code is after the data has been read.
326327
int length = (int) frame.size();
327-
window -= length;
328-
processedWindow -= (length + paddingLen);
328+
window -= (length + paddingLen);
329+
processedWindow -= paddingLen;
329330
if (window < 0) {
330331
frameWriter.rstStream(id(), ErrorCode.FLOW_CONTROL_ERROR);
331332
transport.finishStream(

0 commit comments

Comments
 (0)