Skip to content

Commit 9d2a30d

Browse files
committed
make window update assert catch more
1 parent 771a4d8 commit 9d2a30d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

transport/control.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -220,13 +220,13 @@ func (f *inFlow) onRead(n uint32) uint32 {
220220
func (f *inFlow) preConsumeWindowSpace(n uint32) uint32 {
221221
f.mu.Lock()
222222
defer f.mu.Unlock()
223-
if n > http2MaxWindowUpdate {
224-
grpclog.Fatalf("potential window update too large. n is %v; max n is %v", f.pendingUpdate, http2MaxWindowUpdate)
225-
}
226223
if f.preConsumedWindowSpace > 0 {
227224
grpclog.Fatalf("pre-consuming window space while there is pre-consumed window space stil outstanding")
228225
}
229226
f.preConsumedWindowSpace = n
227+
if f.preConsumedWindowSpace+f.pendingData > http2MaxWindowUpdate {
228+
grpclog.Fatalf("potential window of %v update too large. http2 max window update is %v", f.preConsumedWindowSpace+f.pendingData, http2MaxWindowUpdate)
229+
}
230230
if f.preConsumedWindowSpace+f.pendingUpdate >= f.limit/4 {
231231
wu := f.pendingUpdate + f.preConsumedWindowSpace
232232
f.pendingUpdate = 0

0 commit comments

Comments
 (0)